I have a class A and a class B like this :
class A
{
public:
A(){}
};
class B : public A
{
public:
B() : A()
{
value = 10;
}
int Value()
{
return value;
}
protected:
int value;
}:
I have this code :
int main()
{
A* a = new B();
// how can I access to Value() ? I would like to make that :
int val = a->Value();
// must i cast a to B ? how ?
}
thanks for your help.