#include <iostream>
using namespace std;
class base
{
int i;
public:
int j, k;
void seti(int x) {i = x;}
int geti(void) {return i;}
};
class derived : private base
{
public:
base::j;
base::seti;
base::geti;
int a;
};
int main(void)
{
derived object;
object.j = 20; // legal because j is public
object.a = 40;
object.seti(10);
cout << object.geti() << ", " << object.j << ", " << object.a;
}
|