// This code demonstrates slicing. // The variable p only gets the first part of e. // Consider the difference if it had been a reference or pointer. #include using namespace std; class Person { public: Person(long ss) : ss_num(ss) { } private: long ss_num; // USA citizen or not, but has a social security number }; class Employee : public Person { public: Employee(long social, float pay) : Person(social), pay_rate(pay) { } private: float pay_rate; }; int main() { Employee e(666'00'1234, 20.00); Person p = e; cout << "size of p is " << sizeof(p) << '\n'; cout << "size of e is " << sizeof(e) << '\n'; return 0; }