c++ - g++ (GCC) 4.6.0 I have the following class and I am trying to initialize structure member initialization list of my constructor -


G ++ (GCC) 4.6.0

I have the following category and I started it in My initial list of my constructor is trying.

  square floor_plan {private: unsigned full width; Unsigned intense height; Struct floor_size {unsigned int x; Unsigned int y; } Floor; Public: Floor_plan (): width (0), height (0), floor.x (0), floor.y (0) {} floor_plan (unsigned int_width, unsigned int _height, unsigned int _x, unsigned int_y); ~ Floor_plan () {}; }  

In the code above,

how can we start the floor_size structure without having to do the floor ... thanks in advance for your reply. ...

your structure floor_size is POD (plain old datatype) so that You can get started (0), height (0), bottom () {} member this way:

  floor_plan (): Width (0) P> This will use one of zero-, default- or value-initialization, never me Know not.  

And if you use C ++ 11 support ( -std = c ++ 0x switch) you can use the brace initialization:

  Floor_plan (): width (0), height (0), floor ({10, 20}) {}  

Comments