19 lines
279 B
C++
19 lines
279 B
C++
#include<iostream>
|
|
using namespace std;
|
|
class A {
|
|
public:
|
|
void vf() {
|
|
cout<<"I come from class A"<<endl; }
|
|
};
|
|
class B: virtual public A{};
|
|
class C: virtual public A{};
|
|
class D: public B, public C{};
|
|
|
|
int main()
|
|
{
|
|
D d;
|
|
d.vf (); // okay
|
|
system("pause");
|
|
return 0;
|
|
}
|