Let’s say I have ClientList class and I have declared like this.
class ChatMgr
{
private:
ClientList _userlist;
ClientList *_userlist;
}
Then what is the difference? I know that the second one is the address of the instance and I need to initialize it using new to use it. Then for the first one, can I just access to the all the data members inside of the class without initializing it?
Thanks in advance….
You are correct,
_userListis an actual instance of theClientListclass, so is initialised whenChatMgris (its constructor is called), but*_userlistis a pointer, which is left uninitialised.