S
Shraddha
Is it is possible to derive pivate class members of base class in it's
derive class?
derive class?
Is it is possible to derive pivate class members of base class in it's
derive class?
Is it is possible to derive pivate class members of base class in it's
derive class?
Is it is possible to derive pivate class members of base class in it's
derive class?
See if below technique works for you:
#include <iostream>
using namespace std;
class base {
private:
int a;
public:
base() { a= 100; }
friend class derived;
};
class derivedublic base{
public:
void print() { cout << "The value of a is " << this->a <<
endl; }
};
int main ()
{
derived o2;
o2.print();
return 0;
}
Output:
% ./a.out
The value of a is 100
Cheers
-Vallabha
S7 Software Solutionshttp://www.s7solutions.com/
Is it is possible to derive pivate class members of base class in it's
derive class?
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.