0

I have AbstractClass and virtual int getInfo() = 0; plus static int info; And I have class ConcreteClass with

int ConcreteClass::getInfo()
{
    return info;
}

But I get errors

Undefined reference to 'AbstractClass::getInfo'

and

collect2:error:ld returned 1 exit status

Please tell me what the problem with this is.

Update: Should I define my int info in the AbstractClass constructor?

filmor
  • 30,840
  • 6
  • 50
  • 48
Admiral Land
  • 2,304
  • 7
  • 43
  • 81
  • 1
    Could you show the whole definition of `AbstractClass` and `ConcreteClass`, as well as how you are using them? – Andy Prowl Mar 21 '13 at 10:39
  • 1
    Have you defined the static int `info` in source file? – cmannett85 Mar 21 '13 at 10:42
  • Let me guess (because there is little info), did you forget to add keyword public to the Concrete class declaration?: ConcreteClass:: public AbstractClass – fatihk Mar 21 '13 at 10:45

0 Answers0