C++错误集锦之:error C2243: 'type cast' : conversion exists, but is inaccessible
2012-07-27 15:06
483 查看
看看你的父类是否是public的,如下是正确的范例:
如果:
这样就会报错。
class Dog:public Animal { public: Dog(){cout<<"dog constructor"<<endl;} virtual ~Dog(){cout<<"dog destructor"<<endl;} void cry() const{cout<<"dog cry..."<<endl;} };
如果:
class Dog:Animal { public: Dog(){cout<<"dog constructor"<<endl;} virtual ~Dog(){cout<<"dog destructor"<<endl;} void cry() const{cout<<"dog cry..."<<endl;} };
这样就会报错。
相关文章推荐
- Service 'china' of type 'MapServer' does not exist or is inaccessible
- Inconsistent accessibility: field type '...' is less accessible than field '...'
- 解决 C++错误 error C2679: binary '=' : no operator defined which takes a right-hand operand of type 'class CString' (or there is no
- iOS--错误集锦--Capturing 'self' strongly in this block is likely to lead to a retain cycle
- gcc 4.3.2 编译时 发生 error: redeclaration of C++ built-in type 'bool' 错误
- X-code6 错误CodeSign error: code signing is required for product type 'Unit Test Bundle' in SDK 'iOS 8
- code signing is required for product type 'Application' in SDK 'iOS 9.0'错误
- 关于C#中的错误:The type 'X' does not exists in the "Y"
- C++报错集合:error: 'CppUnit::TestFixture' is an inaccessible base of 'LMQueryConnectionTest'
- qt 错误:request for member 'show' in 'showlist_ui', which is of non-class type 'ShowList*'
- [BEROR]CodeSign error: code signing is required for product type 'Application' in SDK 'iOS 8.1'
- 实用程序软件包(关于使用静态函数报错问题“Static function declared but not defined in C+++ "eh.h is only for C++!"报错问题)
- variable 'std:ofstream' has initializer but incomplete type 错误
- IOS成长之路-code signing is required for product type 'Application' in SDK 'iOS 6.0'
- Inheritance: 'A' is an inaccessible base of 'B'
- 关于Generating user instances in SQL Server is disabled. Use sp_configure 'user instances enabled' to generate user instances的错误
- Solaris 10 如何解决:/usr/include/sys/siginfo.h:259: error: 'ctid_t' is used as a type, but is not
- 两个C++编译错误及解决办法--does not name a type和field `XX' has incomplete type
- 错误 the type "xxxx" is defined in an assembly that is not refernced.You must add a reference to assem
- 有关TypeError: invalid 'in' operand obj的错误