I am an experienced VB6 developer, aware of object-oriented design, but have just started learning C++ this week! I have hit a brick wall with trying to understand the following snippet of code:
CRectangle a, *b, *c;
CRectangle * d = new CRectangle[2];
I am trying to work out the following:
a) Are *b and *c both pointing to a, or are they pointing to a new instance each (i.e. is 1 instance created or 3)?
b) I understand the use of [2] if this was an array (i.e. 3rd element), but here it is used with a class - CRectangle[2]. What exactly would the '3rd element' be in this case, is it *c (3rd instance) or third parameter of the class prototype/definition??
Thanks in advance,
Simon.
CRectangle a, *b, *c;
CRectangle * d = new CRectangle[2];
I am trying to work out the following:
a) Are *b and *c both pointing to a, or are they pointing to a new instance each (i.e. is 1 instance created or 3)?
b) I understand the use of [2] if this was an array (i.e. 3rd element), but here it is used with a class - CRectangle[2]. What exactly would the '3rd element' be in this case, is it *c (3rd instance) or third parameter of the class prototype/definition??
Thanks in advance,
Simon.