Hi there,
Please check my program. When i compile it i am getting error.
Cannot find default constructor to initialzie base class.
#include <iostream.h>
#include <conio.h>
class Parent
{
protected:
double num;
public:
Parent(double n)
{
num = n;
}
void sub()
{
num -= 2.0;
cout << "num = " <<num <<endl;
}
};
class Child : public Parent
{
//protected:
public:
Child()
{
cout << "num = " <<num <<endl;
}
void display()
{
cout << "agian num : " <<num <<endl;
}
};
void main()
{
Parent p(5.0);
p.sub();
Child c;
c.display();
getch();
}