-1

I tried to create a member object (hope this terminus is correct) and it worked. But if I derive the class of the object it fails. Why is this the case and how do I solve that problem?


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;
};
womdom
  • 55
  • 1
  • 6

2 Answers2

0

You forgot ; at the end of derivtest

Andrew
  • 24,218
  • 13
  • 61
  • 90
0

It could be the missing semi-colon after the derivtest declaration:

class derivtest : public test
{

protected:
    int         id;

public:
    derivtest(){};
    ~derivtest() {};
    derivtest(int a){};
};
 ^ here  
juanchopanza
  • 223,364
  • 34
  • 402
  • 480