标签:object 概念 virt 对象 written rtu key 用法 can
virtual is the keyword of defination c++ virtual function
concept:
(1)inheritance as a prerequisite
(2)decorate the function with virtual keyword in the parent class
(3)rewrite thr virtual function in the subclass
effect:
(1)a reference to a parent is used as a parameter type for a function
(2)call the function to pass the subclass object
(3)can call the rewritten virtual function in subclass by the parent class reference
概念:
(1)以继承为前提。
(2)在父类中用virtual修饰函数。
(3)在子类中重写该虚函数。
作用:
(1)以父类的引用作为函数的参数类型。
(2)调用该函数传递子类对象。
(3)在函数中可以通过该父类的引用调用到子类中重写的虚函数。
usage and explanation of c++ virtual keyword virtual 用法和解释
标签:object 概念 virt 对象 written rtu key 用法 can
原文地址:http://www.cnblogs.com/1915884031A-qqcom/p/7672768.html