It seems that in my time away from C++, I've forgotten something that I should still know.
I have this class:
Code:
class cIPAddress
{
public:
cIPAddress(string IPAddress) { IP=IPAddress; }
private:
string IP;
};
And I want to use it as a member of another class, calling the constructor for cIPAddress from within the constructor for the other class:
Code:
class cOtherClass
{
public:
cIPAddress ipaddress;
cOtherClass(string ip){ipaddress(ip);}
};
Obviously, the code in the constructor cOtherClass is not the way to do it; what is?