B
BCC
If I have a base class like this:
class A {
public:
void Foo() { Foo1(); }
void Foo1() { Foo2(); }
void Foo2() { int x = 0; }
};
And I derive from it and override Foo2():
class B: public A {
public:
void Foo2() { int y = 1; }
}
Now if I call Foo() from an instance of my derived class:
B b;
b.Foo();
When it gets to Foo2() it calls the Foo2() from my base class and not my
derived class.
Is this normal behavior? So if I want to override one small function buried
in several other function calls I have to explicitly override all those
functions in my derived class?
Thanks,
Bryan
class A {
public:
void Foo() { Foo1(); }
void Foo1() { Foo2(); }
void Foo2() { int x = 0; }
};
And I derive from it and override Foo2():
class B: public A {
public:
void Foo2() { int y = 1; }
}
Now if I call Foo() from an instance of my derived class:
B b;
b.Foo();
When it gets to Foo2() it calls the Foo2() from my base class and not my
derived class.
Is this normal behavior? So if I want to override one small function buried
in several other function calls I have to explicitly override all those
functions in my derived class?
Thanks,
Bryan