What is the difference between CRect c; and CRect c(), when CRect is a class?
Asked
Active
Viewed 299 times
3
-
3(Careful with the duplicates - I hasty-clicked it too :-/) – Feb 04 '13 at 11:31
-
@pst: Yeah, I pretty much copied the wrong link. :-/ Massive fail on my part. – In silico Feb 04 '13 at 11:35
2 Answers
6
CRect c;
defines an object
CRect c();
declares a function returns CRect
object.
Sometimes people are not aware of second form and get caught by most vexing parse.
6
This one
CRect c;
creates a CRect
object called c
.
This one
CRect c();
declares a function called c()
that returns a CRect
object. It is a parse that is vexing, however, it isn't the most vexing one.

juanchopanza
- 223,364
- 34
- 402
- 480