I'm not coding much in C++, so please forgive me if this is trivial.
My class "Foo" looks somewhat like this:
class Foo {
public: Foo(int n) { }
};
Another class "Bar" is now supposed to have a class member of type "Foo".
class Bar {
private: Foo f;
};
This obviously fails, because there is no constructor for "Foo" that does not require any arguments. However, stuff like Foo f(1);
fails, too.
Is there any way to solve this problem? Or am I supposed to use a pointer here?