0. Virtual function is used for multimod, it only can be used in Class except inline function, It's used at runtime
1. Pure virtual function is a virtual function.
2. Class with pure virtual function is a abstract base class, and can not be concreted. this class is only used as a
parent class, and define the interface prototype.
3. Class with virtual function can be concreted, and used as a common class.
4. Virtual or pure virtual function have the same effect in multimode.
5. Virtual method can not used with static element, due to static element belongs to all class object, and generated
the build time, but virtual function only can used for one object, and used at run time.
6. Pure virtual method must be implied in son class, but it's necessary when it's a virtual method.
本文详细解释了虚拟函数的概念及其使用场景,包括纯虚函数与抽象基类的区别,具体类中虚函数的应用,以及虚函数与静态成员函数之间的差异。此外还讨论了纯虚函数在子类中的实现必要性。
3750

被折叠的 条评论
为什么被折叠?



