-1

我试图创建一个成员对象(希望这个终点是正确的)并且它有效。但是,如果我派生对象的类,它就会失败。为什么会这样,我该如何解决这个问题?


class test 
{
protected:
    int         id;
public:
    test(){};
    ~test() {};
    test(int a){};
};
/* Without Comments it doesn't work
class derivtest : public test
{

protected:
    int         id;

public:
    derivtest(){};
    ~derivtest() {};
    derivtest(int a){};
}
*/

class test2 
{

public:
    test2():teil(){};
private:
    test teil;
};
4

2 回答 2

0

你忘;了最后derivtest

于 2012-07-19T12:04:56.993 回答
0

它可能是声明后缺少的分号derivtest

class derivtest : public test
{

protected:
    int         id;

public:
    derivtest(){};
    ~derivtest() {};
    derivtest(int a){};
};
 ^ here  
于 2012-07-19T12:06:03.843 回答