// C++ does inheritance class A // base class declaration { public: int index; // member variable declaration void doIncrement() { index++; } // member function definition }; class B : public A // derived class declaration { }; main() { B b; b.index = 0; b.doIncrement(); }