error C2248: “CObject::CObject”: 无法访问private 成员(在“CObject”类中声明)
2011-04-29 16:25
549 查看
MFC编程时遇到此问题,原因和解决方法如下:
问题代码:
BayesTest bTest(m_ModelPath);
BayesCategoryTest(bTest, m_TestPath);
其中BayesTest类的对象作为参数传入函数时必须以指针的形式传入,否则无法访问private成员,所以代码应改为:
BayesTest bTest(m_ModelPath);
BayesCategoryTest(&bTest, m_TestPath);
(BayesCategoryTest函数中也需相应修改,bTest调用函数要用”->”)
问题代码:
BayesTest bTest(m_ModelPath);
BayesCategoryTest(bTest, m_TestPath);
其中BayesTest类的对象作为参数传入函数时必须以指针的形式传入,否则无法访问private成员,所以代码应改为:
BayesTest bTest(m_ModelPath);
BayesCategoryTest(&bTest, m_TestPath);
(BayesCategoryTest函数中也需相应修改,bTest调用函数要用”->”)
相关文章推荐
- 错误 88 error C2248: “CObject::CObject”: 无法访问 private 成员(在“CObject”类中声明) c:\program files (x86)\microsoft visual studio 9.0\vc\atlmfc\include\afxcoll.h 590
- error C2248: “CObject::CObject”: 无法访问 private 成员(在“CObject”类中声明)----解决方法
- 【C/C++学习】error C2248: “CObject::CObject”: 无法访问 private 成员(在“CObject”类中声明)
- 错误1 error C2248: “CObject::operator =”: 无法访问 private 成员(在“CObject”类中声明)
- 解决VS2010 C++编译错误:error C2248: “CObject::CObject”: 无法访问 private 成员(在“CObject”类中声明)
- error C2248: “CObject::CObject”: 无法访问 private 成员(在“CObject”类中声明)
- error C2248: “CObject::CObject”: 无法访问 private 成员(在“CObject”类中声明)---解决办法
- 【C/C++学习】error C2248: “CObject::CObject”: 无法访问 private 成员(在“CObject”类中声明)
- error C2248: “CObject::CObject”: 无法访问private 成员(在“CObject”类中声明)
- error C2248: “CObject::operator =”: 无法访问 private 成员(在“CObject”类中声明)
- “CObject::operator =”: 无法访问 private 成员(在“CObject”类中声明)
- error C2248: 无法访问 private 成员(在“QObject”类中声明)
- 错误:“CObject::CObject”: 无法访问 private 成员(在“CObject”类中声明)
- “CObject::CObject”: 无法访问 private 成员(在“CObject”类中声明)
- VC++ error C2248: “CObject::CObject”: 无法访问 private 成员(在“CObject”类中声明)
- C++ error C2248: “CObject::operator =”: 无法访问 private 成员(在“CObject”类中声明
- 问题:无法访问 private 成员(在“CObject”类中声明)
- 错误 1 error C2248: “Point::count”: 无法访问 private 成员(在“Point”类中声明)
- error C2248: “CObject::operator =”: 不可访问 private 员(于“CObject”类声明)
- error C2248: ***: 无法访问 private 成员 可能出现的错误方向