Hi,
  Can anyone tell what is supposed to be the behaviour for a function which is 
declared as virtual in a base class and non-virtual in derived?
Specially pertaining to cases when you cast the derived object into a base 
class object and call the function.

For example:

class Base {
  public:
      virtual void foo() { cout << " I am Base foo \n"; }
};

class Derived : public Base {
  public:
     void foo() { cout << " I am Derived foo\n";}
};

And to extend the question what if another class Derived2 is derived from class 
"Derived" with the function foo being declared as non-virtual. 


Thanks and Regards,
Saurabh

 $ make war 
make: *** No rule to make target `war&#39;. Try `peace&#39; instead



      

Reply via email to