OOP Bisic-desctructor can be virtual,while constructer can not? why?
2008-02-26 11:21
337 查看
A:
virtual function uses virtual calling. virtual calling is a kind of operation mechanism which can run on the condition of part information being provided. it allows us to call a function that we only know the interface while not know accurate object type of the function.
However if we create an object, you must know what kind of the object is accrurately! Therefore, the constructor can not be virtual.
virtual function uses virtual calling. virtual calling is a kind of operation mechanism which can run on the condition of part information being provided. it allows us to call a function that we only know the interface while not know accurate object type of the function.
However if we create an object, you must know what kind of the object is accrurately! Therefore, the constructor can not be virtual.
相关文章推荐
- 使用mysql-connector-java.jar连接MySql时出现:Error while retrieving metadata for procedure columns: java.sql.SQLException: Parameter/Column name pattern can not be NULL or empty.
- why 'not in' can not be followed with 'null'
- Somebody~why I can not be there where you are??????????????
- JAX-RS(REST Web Services)2.0 can not be installed: One or more constraints have not been satisfied
- Why are destructors not virtual by default?
- JavaServer Faces 2.0 can not be installed解决方案
- java.sql.SQLException:Value '0000-00-00' can not be represented as java.sql.Date
- google chrome can not be run as root
- mod_ssl has been requested but can not be built due to prerequisite failures
- Java EE 开发中遇到String can not be resolved to a type
- 解决 java.sql.SQLException: Value '0000-00-00 00:00:00' can not be represented
- maven+springmvc错误 JAX-RS (REST Web Services) 2.0 can not be installed
- setContentView R can not be resovled
- 错误“a label can only be part of a statement and a declaration is not a statement”解决方法
- Hololens开发-The associated script can not be loaded
- 如何解决The following assembly name can not be resolved automatically 提示
- import android包出错(The import android can not be resolved)
- why can not across external form the inter of a thread
- The virtual machine could not be added. The virtual machine configuration could not be added. A configuration with this name already exists.
- Value '0000-00-00' can not be represented as java.sql.Date或是java.sql.Timestamp
about #define, const
C/C++ Basic-- the differs between [malloc&free] and [new &delete]