4495766362
From-SVN: r23760
37 lines
779 B
C
37 lines
779 B
C
#include <iostream.h>
|
|
|
|
class foo {
|
|
public:
|
|
foo(int i) {k = i;}
|
|
protected:
|
|
int k;
|
|
};
|
|
|
|
class bar_1 : public foo {
|
|
public:
|
|
bar_1(int i) : foo(i) {}
|
|
int get_k() {return k;}
|
|
};
|
|
|
|
class bar_2 : public foo {
|
|
public:
|
|
bar_2(int i) : foo(i) {};
|
|
int get_k() {return k;}
|
|
};
|
|
|
|
class multiple : public bar_1, public bar_2 {
|
|
public:
|
|
multiple(int i1, int i2) : bar_1(i1), bar_2(i2) {}
|
|
void print() {
|
|
cout << "bar_1::k -> " << bar_1::k << "\n";
|
|
cout << "bar_2::k -> " << bar_2::k << "\n";
|
|
cout << "bar_1::get_k() -> " << bar_1::get_k() << "\n";
|
|
cout << "bar_2::get_k() -> " << bar_2::get_k() << "\n";
|
|
}
|
|
};
|
|
|
|
int main() {
|
|
multiple m(1,2);
|
|
m.print();
|
|
}
|