virtual function

I am working on a project using native c++ and the following is the legacy code.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
class B
{};

class D : public class B
{
   private:
       dataType e    
   public:
       void goo(...);
       virtual void foo(dataType* T) {}
};

void D :: goo(...)
{
    //do something
    ....

    foo( &e );

};


My question is since foo() is a virtual function and does nothing, why goo() call foo() function?
Last edited on
Because someone might derive from D and override foo() with a non-empty implementation.
Because foo() might do something in derived classes.
OK I see. Thanks for your comments.
Topic archived. No new replies allowed.