我有一些看起来像这样:如何从外部类构造成员类对象(C++)
class Foo
{
public:
Foo(parameter);
}
class Bar
{
Foo fooObject;
}
Bar::fooObject(data);
,但我得到:
error: expected constructor, destructor, or type conversion before '(' token
所以我的问题是:我该如何构建来自外部Bar的fooObject?
它需要是静态的,并且定义需要一个类型。 – Dan
你没有。你为什么想要? – molbdnilo
听起来像是你可以使用[好C++的书(http://stackoverflow.com/questions/388242/the-definitive-c-book-guide-and-list) – NathanOliver