Nindi Singh wrote:
class Base {
  public:
    virtual void func()=0;
};

class Derived:public Base {
  public:
    void func(){}
};
[snip]
I am curious the method 'func' in class Derived is described as virtual. Its 
not. If I am missing something, then how can I tell whether a function 'may' be 
overloaded in a derived class or not.

Yes, it is declared virtual. It does not matter whether the virtual keyword is present. If there is a function with the same signature in the parent class that is declared virtual it implicitly makes your function virtual. This is a C++ rule.

If instead you write

class Base {
  public:
    virtual void func()=0;
};
class Derived: public Base {
  public:
    void func(int) {}
};

then Derived::func is not virtual because it does not match the signature from Base::func. Instead you will be left with an abstract class because Base::func is pure-virtual so it must be defined in Derived to make it a concrete type.

-Brad

_______________________________________________
gccxml mailing list
[email protected]
http://www.gccxml.org/mailman/listinfo/gccxml

Reply via email to