Constructors in a composite class

Started by
21 comments, last by Sneftel 14 years, 2 months ago
What's up GameDevers, If a class has other classes as data member, when that class's constructor is invoked, are the constructors of the classes that belong to it invoked as well?
Advertisement
In what programming language?
Sorry about that, it is C++.
For a class A, the constructors of all A's member variables will be called before execution flow will enter the first curly brace any of A's constructors.
Not if'n you use class* A
"It's like naming him Asskicker Monstertrucktits O'Ninja" -Khaiy

class * A doesn't even compile, so I fail to see your point.
seriously?
"It's like naming him Asskicker Monstertrucktits O'Ninja" -Khaiy

Quote:Original post by mrchrismnh
seriously?
Why not clarify, so that we can better understand what you're getting at?
I mean does he really not understand what I am saying, or is he chiding me for not being precise about it. I suspect the latter.
"It's like naming him Asskicker Monstertrucktits O'Ninja" -Khaiy

Quote:Original post by mrchrismnh
I mean does he really not understand what I am saying, or is he chiding me for not being precise about it. I suspect the latter.
I have a pretty good guess as to what you're trying to say, but it's just that (a guess).

Really, how hard would it be to give an example, or go into just a little more detail so that there's no ambiguity?

This topic is closed to new replies.

Advertisement