dimanche 19 juillet 2020

C++: Initialising an object of a parameterized class inside another class

I want to write a program in which an object of a parameterized class A has to be initialised inside another class B. I should not initialise the object: A a(parameter list); of class A while declaring the object a which is outside the constructor of class B. The necessary parameters to the object a are gotten through the constructor of B. How to initialise 'a' inside B's constructor with the required parameters?

Aucun commentaire:

Enregistrer un commentaire