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