Constructor
CODE:
#include <iostream>
using namespace std;
class vubwn{
public:
vubwn(int a,int b){
cout<<"Sum :"<<a+b<<endl;
}
};
int main()
{
vubwn obj(3,4);
return 0;
}
Accessing base class member functions
in derived class:
#include <iostream>
using namespace std;
class A{
public:
int a,b;
void sum(){
cout<<"Sum :"<<a+b<<endl;
}
};
int main()
{
A obj;
obj.a=2;
obj.b=34;
obj.sum();
return 0;
}
0 Comments
If you have any queries please drop in your comments.