{}
run-icon
main.cpp
#include <iostream> class A { public: A() { std::cout<<"Constructor of A called\n"; } public: void f1() { std::cout<<"F1 function of A called\n"; } public: void f2() { std::cout<<"F2 function of A called\n"; } public: void f3() { std::cout<<"F3 function of A called\n"; } }; class B: public A { public: B():A() { std::cout<<"Constructor of B called\n"; } public: void f1() { std::cout<<"F1 function of B called\n"; A::f1(); } public: void f2() { std::cout<<"F2 function of B called\n"; } }; int main() { // A a; // a.f1(); B b; b.f1(); b.f2(); b.f3(); return 0; }
Output