RUPAK SEARCH ENGINE

Custom Search

constructor in base & derived class without default constructor

constructor in base & derived class without default constructor

# include
# include
using namespace std;

class base
{
public:
base (int data)
{
cout<<"\nI am from one argument base class constructor";
}
};

class derived:public base
{
public:
derived(int data):base(data)
{
cout<<"\nI am one constructor derived class constructor";
}
};

int main()
{
derived d(5);
getch();
return 0;
}

No comments:

Post a Comment