#include using namespace std ; class Person { public: string firstName ; string lastName ; string getName() { return ( firstName + " " + lastName ) ; } void print() { cout << getName() << endl ; } }; class Employee : public Person { public: string jobTitle ; void print() { // cout << getName() << " " << jobTitle << endl ; cout << getName() << " " << endl ; } }; int main() { Employee e1 ; //Can access the base class variables e1.firstName = "Alan" ; e1.lastName = "Turing" ; e1.jobTitle = "Programmer" ; e1.print() ; Person* p1 = new Person() ; //p1 = &e1 ; //Can't do Employee* e2 = (Employee*)p1 ; e2->print() ; return 0 ; }