PDA

View Full Version : Base class problem



JohnnyKPL
05-04-2015, 11:18 AM
I have a base class, "A", that derive the class "B":

example.h


class A
{
private:
protected:
public:
A();
virtual ~A();
virtual void foo() = 0;
};

class B : public A
{
private:
int number;

protected:
public:
B(int number);
~B();
void foo();
};


example.cpp


B::B(int number) : number(number) {}

B::~B() {}

void A::foo()
{
// How can I get the variable "number" from here???
}

mhagain
05-04-2015, 01:00 PM
This has absolutely nothing to do with OpenGL.