Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Class in a class (C++)

Name: Anonymous 2007-06-29 7:25 ID:gaE5eFHD

Lets say I have this following class:

class Settings {
public:
  Settings(char *filename);
  ~Settings();
protected:
  class Anotherclass anotherclass;
};


Upon the Constructor call 'Settings' it says error C2512: '' : no appropriate default constructor available. How do I get a class to be inside another class?

Name: Anonymous 2007-06-29 7:52 ID:97MK14mD

Remove that 'class' keyword, it's wrong.

If Anotherclass doesn't have a default constructor, you'll have to call one of its explicit constructors in the Settings's constructor initializer list.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List