C2512: no appropriate default constructor availabl
来源:互联网 发布:网络棋牌游戏充值 编辑:程序博客网 时间:2024/05/17 08:50
This error usually occurs when you implement the constructor function of a derived class and forget to include parameter passing to the base class constructor function. For example assume that CDerived is derived from CBase and that the CBase constructor function requires one parameter (e.g., int A). If you define the CDerived constructor function as:
CDerived::CDerived(int A, int B) { ... }
the compiler will issue the above error message on the line containing the function header of CDerived::CDerived() because you haven't provided instructions for routing the parameter A to CBase::CBase(). Because you didn't provide instructions the compiler assumes that CBase::CBase() requires no arguments and it complains because no version of CBase::CBase() has been defined that accepts zero arguments.
If you intended to provide a version of CBase::CBase() that requires no arguments then the error message indicates that you forgot to declare that function in your base class declaration (e.g., in CBase.h).
If CBase::CBase() does require one or more arguments then you must correct the problem by including explicit instructions for passing parameters from the derived class constructor function to the base class constructor function. The correction for the example above is:
CDerived::CDerived(int A, int B) : CBase(A) { ... }
- C2512: no appropriate default constructor availabl
- 【error C2512】VC++编译错误 no appropriate default constructor available
- C2512 : no appropriate default constructor available 的另一种错误原因
- error C2512: \'CSample\' : no appropriate default constructor available
- f:\arm\program\point\point\point.cpp(24) : error C2512: 'Time' : no appropriate default constructor
- VC中编译错误 no appropriate default constructor available【error C2512】
- no appropriate default constructor available
- no appropriate default constructor available
- vc++ 编译错误“no appropriate default constructor available”解决方法
- vc++ 编译错误“no appropriate default constructor available”解决方法
- VC 之定义类变量时出现 no appropriate default constructor available
- default constructor and no-parameter constructor
- IntentService has no default constructor
- xxApplication has no default constructor
- 错误总结之no appropriate constructor in class
- No default constructor for entity解决
- 关于has no default constructor的错误
- there is no default constructor available in ...
- What I have done as a DBA
- outlook2007 忘写主题 提示
- 我的9年IT路
- MPLS VPN技术原理 上
- 字符串比较函数
- C2512: no appropriate default constructor availabl
- action中bean不初始化的原因
- Spring.NET1.2+Nhiberate1.2在使用GridView中碰到的几个问题
- Python语法笔记
- [转] C# ms speech文字转语音例子
- RedHat 下安装tomcat
- syslog-ng 与 logrotate
- 将传入的文件内容包装成一个zip形式
- linux stat函数讲解