I have a class "A", and a class "B" such that A contains an instance of B
class A
{
B b = B(parameters...);
Other thing = 3;
}
The problem with this code, is that B does not (and should not!) have a copy constructor, so the compiler is complaining
I would like to be able to call B's constructor like below, but it interprets it as a function declaration
class A
{
B b(parameters...);
Other thing = 3;
}
Is there a way to call the non-default constructor in the definition of the class?
Aucun commentaire:
Enregistrer un commentaire