Class A has two data members which are instances of class B and class C. Class B needs an instance of class C to be created. We have to create an instance of object A on stack like 'A objA' in main function. 'new' operator should not be used anywhere.no objects on the heap
Basically no objects on the heap. I initially did this using 'new' operator. But the interviewer said like inside only 'A objA' is allowed. Once it is executed, the whole object should be created.
Aucun commentaire:
Enregistrer un commentaire