#include <iostream>
class A{
public:
virtual void foo() = 0;
};
void A::foo() { std::cout << "A foo"; }
class B : public A{};
class C : public A{
public:
void foo();
};
void C::foo() { std::cout << "C foo"; }
class D: public A{
public:
void foo();
};
void D::foo() { A::foo(); }
class E: public A{
public:
//using A::foo;
void foo(int) { std::cout << "E foo"; }
};
int main(){
(new A)->foo(); // 1
(new B)->foo(); // 2
(new C)->foo(); // 3
(new D)->foo(); // 4
(new E)->foo(2); // 5
}
Login in to like
Login in to comment