HI, im just getting a grasp on initializer lists, and learnt that const should be iniatilized in there, how do i go about doing that.
How do i iniatilize dateofbirth,
i tried birthdate=dateOfbirth, and got a lot of error, so im guessing thats wrong.
Code:
class Brain
{
public:
Brain(int iq);
void setIQ(int iq);
};
class String
{
public:
String(const char* str);
String(const String& other);
const String& operator=(const String& other);
const String& operator=(const char* str);
~String();
};
class Car {};
class Person
{
public:
Person(const char* rName, long dateOfBirth, int iq, int rIncome):brain(iq),name(rName)
{
income=rIncome;
}
private:
String name;
Brain brain;
const long birthdate;
Car* pCar;
double income;
};