Move all C++ tests to cpp.
This commit is contained in:
48
cpp/virtual_inheritence.cpp
Normal file
48
cpp/virtual_inheritence.cpp
Normal file
@@ -0,0 +1,48 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
class A
|
||||
{
|
||||
public:
|
||||
A()
|
||||
{
|
||||
puts( "called A::A()" );
|
||||
}
|
||||
|
||||
A( int /*fake*/ )
|
||||
{
|
||||
puts( "called A::A( int )" );
|
||||
}
|
||||
};
|
||||
|
||||
class B : virtual public A
|
||||
{
|
||||
public:
|
||||
B()
|
||||
: A( 6 )
|
||||
{
|
||||
puts( "called B::B()" );
|
||||
}
|
||||
};
|
||||
|
||||
class C : public B
|
||||
{
|
||||
public:
|
||||
C()
|
||||
{
|
||||
puts( "called C::C()" );
|
||||
}
|
||||
};
|
||||
|
||||
int main ()
|
||||
{
|
||||
puts( "constructing C object" );
|
||||
C o;
|
||||
|
||||
puts( "" );
|
||||
puts( "constructing B object" );
|
||||
B ob;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user