Program of Hierarchical Inheritance

/*Program of Hierarchical Inheritance*/ #include #include class A { int q; public: void getdata(int w) { q=w; } void display() { cout<<“\n\nq=”<<q<<“\nI am the member of Class A\n”; } }; class B:public A { int e; public: void setdata(int r) { e=r; } void show() { cout<<“\n\ne=”<<e<<“\nI am the member of Class B derived from Class A\n”; } }; class C:private A { int t; public: void putdata() { t=5; cout<<“\n\nt=”<<t<<“\nI am the member of Class C derived from Class ……

Program of Dynamic Constructor

/*Program of Dynamic Constructor*/ #include #include #include class abc { char *string; int length; public: abc() { length=0; string=new char[length+1]; strcpy(string,” “); } abc(char *s) { length=strlen(s); string=new char[length+1]; strcpy(string,s); } void display() { cout

Program of FUNCTION OVERLOADING

/*Program of FUNCTION OVERLOADING*/ #include #include int add(int,int,int); // function declaration float add(float,float); // function declaration int add(int q, int w, int e) // function definition { return (q+w+e); } float add(float a, float s) // function defintion { return (a*s); } int main() { int q,w,e; float a,s; coutq>>w>>e; int p=add(q,w,e); // function calling through parameters cout