why virtual functions can't be static class member and friend functions?

  1. Why virtual functions can't be static?
    virtual functions are bound to an instance of a class, and you can't call it without an instance(object) of the class. static functions are bound to the class itself, and you do not need an instance of the class to call a static function.

  2. Why virtual functions can't be friend functions?
    Virtual functions are member functions internal to a class and friend functions are external to the class. So you obviously can't be both.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.