#include using namespace std; int main(void) { { int i = 2; int j = 2; int s=(i++)+(++j); cout << s << endl; } { int c, a; int b=a=((c=5)*2+7)/4; cout << b << endl; } { int a = 5; int b = 0; int &r = a; r = b++; cout << a << r << b; } { uint32_t a = 20; uint32_t b = 14; int c = a ^ b; cout << c << endl; } { struct A { ~A() { cout << "~A" << endl; } }; struct B : public A { virtual ~B() { cout << "~B" << endl; } }; A *a = new B; delete a; } { double a = 52.0562; float b = 14.25; int c; c = (int) a; a = (double) b; cout << c << " " << a << endl; } { struct Base { virtual void print( int x = 1) { cout << "Base: " << x << endl; } }; struct Derived : Base { virtual void print( int x = 2) { cout << "Derived: " << x << endl; } }; Base * b = new Derived; b->print(); } { struct A { void f() {} }; struct B { int f() {return 0;} }; struct C : A, B { }; C* pc = new C; // pc->A(); // invalid use of main()::A::A pc->A::f(); pc->B::f(); // pc->A::B::f(); // A::B has not been declared } { struct A { virtual ~A() { f(); } virtual void f() { cout << "A::f" << endl; } }; struct B : public A { ~B() {} virtual void f() { cout << "B::f" << endl; } }; A* a =new B; delete a; } return 0; }