   default variable initialization in C++
  In C# you initialize class bool and int members at declaration. In C++ is the constructor the means to do it?   
  Yes, you initialise in the constructor, specifically, you use initaliser lists. You can initialise static const integral members in the declaration however.   ;  Ok   ;  What is the syntax layout to declare and define a descendant class constructor which calls the ascendant constructorclass gm[gm();];gm::gm()[]class gmhair : gm[gmhair();];gmhair:: gmhair() : gm()[] [Edited by - Calin on May 2, 2009 2:13:39 AM];  This is the syntax (you use the initialization list that rip-off mentioned)class A{public:// constructorA();};A::A(){}class B : public A{public:B();};B::B() : A(){};  ok, I'll try that. I have arguments in the constructors, the errors come from there I think[Edited by - Calin on May 2, 2009 5:49:35 AM];  It works fine with arguments, too. You just have to make them line up, i.e. call one of the base's actual constructors from the derived constructor initialization list.class Base {  int x;  public:  Base(int x) : x(x) {}};class Derived: public Base {  int y:  public:  Derived(int x, int y): Base(x), y(y) {}};Here, 'x' is forwarded to the Base constructor, where it is used to initialize the 'x' member of the Base part of the derived instance. 'y' is used directly.   ;Quote:Original post by ZahlmanIt works fine with arguments, too. You just have to make them line up, i.e. call one of the base's actual constructors from the derived constructor initialization list.class Base {  int x;  public:  Base(int x) : x(x) {}};class Derived: public Base {  int y:  public:  Derived(int x, int y): Base(x), y(y) {}};Here, 'x' is forwarded to the Base constructor, where it is used to initialize the 'x' member of the Base part of the derived instance. 'y' is used directly.thx,what happens with class variables at instantiation when a) there isnt a constructor declared  b) there is or there is not a constructor declared and instantiation takes place on the heap  d)  there are more than one constructor declared[Edited by - Calin on May 2, 2009 12:02:30 PM];Quote:Original post by Calinwhat happens with class variables at instantiation when a) there isnt a constructor declaredAll classes have at least one constructor. If you don't declare any, the "default constructor" is generated. It takes zero arguments, and simply calls zero-argument constructors for any members and base classes. If those members or base classes don't have a zero-argument constructor, then the compiler reports an error.Quote:b) there is or there is not a constructor declared and instantiation takes place on the heapAllocation has nothing to do with construction. All the same things happen, just within the allocated chunk of the heap, instead of on the top of the stack.Quote:d)  there are more than one constructor declaredIf you have any constructor declared, then a default constructor is not generated. If you want a specific constructor to be used for initialization, you need to call it in the initialization list. (The compiler will figure out which one you want according to the arguments you provide.) Otherwise, the zero-argument constructor is used, if it exists; otherwise the compiler reports an error, as before.There can, of course, be only one zero-argument constructor for a class, because the default one is not generated if you define one, and you can't define two (because it would really be two different definitions of the same constructor, and the compiler would report an error for that, too).   ;  I was the engine I was using that was giving me troubles I think, I was building an object inheriting from an engine base class. Zahlman thanks for taking time to explain things.   