KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
My questions is, suppose we have two classes A and B. I want to have an object of B in class A. Should I use, class A { public: A(); ~A(); B* b; }; or class A { public: A(); ~A(); B b; }; As far as I know, in the first scenario, I can initialize the object *b using new operator and for the second scenario, I can initialize b using an initialization list if I don't want to use the default constructor of class B . Which is more convenient to use?
Tags (comma-separated)
Save Edits
Cancel