Does the standard support structs have constructors?
Question about structs
Collapse
This topic is closed.
X
X
-
mario.demiguel@gmail.comTags: None -
Mateusz Åoskot
Re: Question about structs
mario.demiguel@ gmail.com wrote:[color=blue]
> Does the standard support structs have constructors?
>[/color]
Yes,
Here is example copied from standard (draft, 2005-10-19):
struct X { // defines X
int x; // defines non-static data member x
static int y; // declares static data member y
X (): x (0) { } // defines a constructor of X
};
Cheers
--
Mateusz Åoskot
-
mlimber
Re: Question about structs
mario.demiguel@ gmail.com wrote:[color=blue]
> Does the standard support structs have constructors?[/color]
Yes. Structs and classes have only a few minor differences. See the
FAQ:
In addition, structs default to public inheritance, whereas classes
default to private.
Cheers! --M
Comment
Comment