关于c++中public & private方法调用问题
class IDNoIdentifier
{
public:
IDNoIdentifier();
~IDNoIdentifier(); typedef vector<cv::Rect> CvRectVectorType; bool Init();
bool Cleanup();
bool HandleData(const Mat& rawImg,string& sNoInfo,string& sError); private:
bool IDNoLocation(const Mat& rawImg, //输入原始BGR24数据
Mat& dstImg, //经偏转校正等处理后的结果图,BGR8(灰度图),该函数内创建内存
CvRectVectorType& IDNoVector, //基于灰度图的字符位置序列
string& sError); //如果处理失败,返回失败原因 bool IDNoIdentify(const Mat& dstImg,const CvRectVectorType& IDNoVector,string& sInfo,string& sError); private:
};
bool IDNoIdentifier::HandleData( const Mat& rawImg,string& sNoInfo,string& sError)
{
if (rawImg.empty())
{
return false;
}
Mat dstImg;
CvRectVectorType posionVec;
if (!IDNoLocation(rawImg,dstImg,posionVec,sError))
{
if (!dstImg.empty())
{
dstImg.release();
}
return false;
} ....
}
public类型的HandleData里面包括了一个private的IDNoLocation
class codeExtract
{
public:
codeExtract();
~codeExtract();
private: Mat picProcess(Mat img);
}
bool IDNoIdentifier::IDNoLocation( const Mat& rawImg,Mat& dstImg,CvRectVectorType& IDNoVector,string& sError)
{ codeExtract code; /*图片二值化*/
Mat img=code.picProcess(rawImg); //字符清楚,矫正角度
...
}
会报错, error C2248: “codeExtract::picProcess”: 无法访问 private 成员(在“codeExtract”类中声明)
原因:因为这是IDNoIdentifier类下的方法啊。在这个类下不能看到类codeExtract中定义的私有方法滴
关于c++中public & private方法调用问题的更多相关文章
- 在同一个类中,一个方法调用另外一个有注解(比如@Async,@Transational)的方法,注解失效的原因和解决方法
参考原贴地址:https://blog.csdn.net/clementad/article/details/47339519 在同一个类中,一个方法调用另外一个有注解(比如@Async,@Trans ...
- 【转】在同一个类中,一个方法调用另外一个有注解(比如@Async,@Transational)的方法,注解失效的原因和解决方法
参考 原文链接 @Transactional does not work on method level 描述 在同一个类中,一个方法调用另外一个有注解(比如@Async,@Transational) ...
- Spring同一个类中的注解方法调用AOP失效问题总结
public interface XxxService { // a -> b void a(); void b(); } @Slf4j public class XxxServiceImpl ...
- Java中public,private,protected,和默认的区别
Java中public,private,protected,和默认的区别 1.private修饰词,表示成员是私有的,只有自身可以访问: 2.protected,表示受保护权限,体现在继承,即子类可以 ...
- vue中methods一个方法调用另外一个方法
转自http://blog.csdn.net/zhangjing1019/article/details/77942923 vue在同一个组件内: methods中的一个方法调用methods中的另外 ...
- php class中public,private,protected的区别,以及实例
一,public,private,protected的区别 public:权限是最大的,可以内部调用,实例调用等. protected: 受保护类型,用于本类和继承类调用. private: 私有类型 ...
- PHP中public,private,protected,abstract等关键字用法详解
PHP中常用的关键字 在PHP中包含了很多对函数和类进行限制的关键字,常用的通常有abstract,final,interface,public,protected,private,static等等, ...
- 【SSH】——Struts2中的动态方法调用(一)
首先我们来看一个简单的调用: 1.在web.xml中配置拦截器StrutsPrepareAndExecuteFilter.StrutsPrepareAndExecuteFilter实现了filter接 ...
- 简谈 JavaScript、Java 中链式方法调用大致实现原理
相信,在 JavaScript .C# 中都见过不少链式方法调用,那么,其中实现该类链式调用原理,大家有没有仔细思考过?其中 JavaScript 类库:jQuery 中就存在大量例子,而在 C# 中 ...
随机推荐
- Active Job 基础
开发中涉及到调用三方服务API,运行时间长,结果不需要实时反馈给用户这样的任务,都可以使用异步处理.常见的场景包括:发邮件和短信.图片处理.定时清理等.爬虫. 后端处理软件可以自行选择这里选择了sid ...
- 记springboot+mybatis+freemarker+bootstrap的使用(2)
二.springboot+mybatis的使用 1.springboot的注解:@SpringBootApplication :启动项目:整合常用注解(@Configuration,@EnableAu ...
- 成都Uber优步司机奖励政策(1月14日)
滴快车单单2.5倍,注册地址:http://www.udache.com/ 如何注册Uber司机(全国版最新最详细注册流程)/月入2万/不用抢单:http://www.cnblogs.com/mfry ...
- 调用bash的时候出现curl command not found
调用bash的时候出现curl command not found 解决办法: apt-get install curl
- protected修饰符详解
protected这个修饰符,各大参考书都会这样说:访问权限为类内,包内和子类,因此在父类中定义的方法和成员变量如果为protected修饰的,是可以在不同包中的子类进行访问的,示例代码如下: pac ...
- 文件同步 单向rsync 双向unison 监控inotifywait 免密登录
1.负载均衡中文件同步必不可少,我这边选择rsync来实现文件同步 rsync同步文件机制更适用于单向文件同步,可配合unison实现双向同步功能. 实现同步的两种方法 一:ssh方法 rsync - ...
- CentOS 7.2安装11g Grid Infrastructure
Preface Oracle claimed that 11g RAC is supported on Redhat Linux 7 and above version,but the ...
- 「日常训练」Kefa and Dishes(Codeforces Round #321 Div. 2 D)
题意与分析(CodeForces 580D) 一个人有\(n\)道菜,然后要点\(m\)道菜,每道菜有一个美味程度:然后给你了很多个关系,表示如果\(x\)刚好在\(y\)前面做的话,他的美味程度就会 ...
- jmeter "you cannot switch bacause data cannot be converted to target Tab data,empty data to switch"报错
jmeter "you cannot switch bacause data cannot be converted to target Tab data,empty data to swi ...
- linux部署maven
1.下载安装包 https://maven.apache.org/download.cgi 2.解压,并配置环境变量 vim /etc/profile export MAVEN_HOME=maven目 ...