So I'm doing this time code, basically you have to make three classes, one with normal time, one with 24 hour format and one with 12 hour. 24 and 12 hours should inherit from Base time class. And it should set the time too. For example if we enter 25 hours, it should automatically set it to 1. Same with the minutes. But I'm getting this weird error here ;
ERROR: conversion from ‘Atime*’ to non-scalar type ‘Atime’ requested
Actually i haven't studied C++ with OOP but Java. If anyone would help me I'll be thankful
ASSIGNMENT LINK : https://drive.google.com/open?id=1oW7sGE7pMMNjNv5OegeryE2qPIk_AZ_y
Here's The CODE:
#include <iostream>
using namespace std;
class Atime
{
private:
int hours;
int minutes;
public:
Atime ()
{
}
Atime (int h, int m)
{
setHours (h);
setMinutes (m);
}
void setHours (int h)
{
hours = h;
}
void setMinutes (int m)
{
minutes = m;
}
int getHours ()
{
return hours;
}
int getMinutes ()
{
return minutes;
}
void print ()
{
cout << "Hours: " << hours;
cout << "Minute: " << minutes;
}
};
class Mtime:public Atime
{
Mtime ()
{
}
Mtime (int h, int m)
{
setHours (h);
setMinutes (m);
}
void print ()
{
cout << "Hours: " << getHours ();
cout << "Minute: " << getMinutes ();
}
};
int main ()
{
Atime obj = new Atime (23, 23);
}