Inheritance Question
From: BCC (bcc_at_akanta.com)
Date: 01/28/05
- Next message: hugo.elias_at_virgin.net: "Re: Model View Controller - please clarify"
- Previous message: Adios: "Re: MFC"
- Next in thread: Adios: "Re: Inheritance Question"
- Reply: Adios: "Re: Inheritance Question"
- Reply: Efrat Regev: "Re: Inheritance Question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 28 Jan 2005 18:35:26 GMT
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
- Next message: hugo.elias_at_virgin.net: "Re: Model View Controller - please clarify"
- Previous message: Adios: "Re: MFC"
- Next in thread: Adios: "Re: Inheritance Question"
- Reply: Adios: "Re: Inheritance Question"
- Reply: Efrat Regev: "Re: Inheritance Question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|