#include <iostream>
#include <initializer_list>
#include <string>
#include <vector>
#include <memory>
using std::cout;
using std::endl;
using std::ends;
using std::flush;
using std::shared_ptr;
using std::make_shared;
using std::string;
using std::vector;
using std::nothrow;
using std::unitbuf;
using std::nounitbuf;
#define TEST
#if TEST1
class Base
{
public:
virtual void function1() {};
virtual void function2() {};
};
class D1: public Base
{
public:
virtual void function1() {cout <<"d1 11"<<endl;}
};
class D2: public Base
{
public:
virtual void function2() {};
};
int main()
{
D1 d1;
Base* dPtr = &d1;
dPtr->function1();
return 0;
}
#else
class Base1
{
public:
int i;
virtual void print()
{
cout << "base::print";
}
};
class Deriv:public Base1
{
public:
virtual void print()
{
cout << "Deriv::print";
}
};
int main()
{
cout << sizeof(Base1) << "," << sizeof(Deriv) << ","<<sizeof(int);
return 0;
}
#endif
|