in this example class what will happen to the year of birth? Will it have a garbage value?
Code:
Car* m_pCar;
> double m_salary;
> const int m_yearOfBirth;
>public:
> Person(int yearOfBirth, Car* pCar, double salary):
> m_yearOfBirth(yearOfBirth){
> m_pCar=pCar;
> m_salary=salary;
> }
>
> Person(const Person& other): m_yearOfBirth(other.m_yearOfBirth){
> m_pCar=other.m_pCar;
This will make the two persons share the same car.
> m_salary=other.m_salary;
> }
>
> const Person& operator=(const Person& other){
So what happend to the year of Birth?
> m_pCar= other.m_pCar;
> m_salary= other.m_salary;
> }
>
> ~Person(){
> delete m_pCar;
> }
>