error C2248: 'MyString::pCharArray' : cannot access private member declared in class 'MyString'
{
os<<mystr.pCharArray;
return os;
};
编译出错;
error C2248: 'MyString::pCharArray' : cannot access private member declared in class 'MyString'
修改:
std::ostream & operator<<(std::ostream & os,const MyString & mystr)
{
os<<mystr.pCharArray;
return os;
};
OK!
I've been bitten on the bum by this numerous times; the definition of your operator overload doesn't quite match the declaration, so it is thought to be a different function.
The signatures don't match. Your non-member function takes fun& fun, the friend declared on takes const fun& fun.
error C2248: 'MyString::pCharArray' : cannot access private member declared in class 'MyString'的更多相关文章
- CStringArray error C2248: 'CObject::CObject' : cannot access private member declared in class
在开发中将一个字符串分割,并将子字符串保存在CStringArray中,专门写了一个函数,如下: SplitStringToCString(CString str, TCHAR tszSplit, C ...
- error C2248: 'QObject::QObject' : cannot access private member declared in class 'QObject'
1.error C2471: cannot update program database vc90.pdb 解决方案:https://blog.csdn.net/shuixin536/article ...
- [置顶] c++,vc6.0,中友元函数,无法访问私有字段(private)的问题(problem),cannot access private member declared in class 'Date'
c++,vc6.0,中友元函数,无法访问私有字段(private)的问题(problem),cannot access private member declared in class 'Date' ...
- error C2248: “CObject::operator =”: 不可访问 private 员(于“CObject”类声明)
MFC如果编码错误: 演出:error C2248: "CObject::operator =": 不可访问 private 员(于"CObject"类声明) ...
- VC++ error C2248: “CObject::CObject”: 无法访问 private 成员(在“CObject”类中声明)
在使用诸如:CArray或是 CList等类时,经常会出现此错误 此错误的原因是由于自定义的类的数组项时 有一个操作如 Add() 在这个操作中,实际上需要一个 = 操作,但是这个 =操作在 自定 ...
- 错误 88 error C2248: “CObject::CObject”: 无法访问 private 成员(在“CObject”类中声明) c:\program files (x86)\microsoft visual studio 9.0\vc\atlmfc\include\afxcoll.h 590
最近接收了以前新公司遗留的代码,一个函数动不动就少的一千行,多的几千行,真是受不了这编码风格! 于是便使用了VS自带的重构工具,选择代码后右键-重构-提取方法,提取完方法就编译不过,想了好久原因,原来 ...
- java.lang.IllegalAccessException: Class XX can not access a member of class XXX with modifiers "private static"
当前需求: 利用反射获取某一属性值运行结果:java.lang.IllegalAccessException: Class com.example.demo.test.Reflect can not ...
- Class org.apache.struts2.json.JSONWriter can not access a member of class org.springframework.aop.TruePointcut with modifiers "public"
Spring注入Action使用Json错误:org.apache.struts2.json.JSONException: org.apache.struts2.json.JSONException: ...
- org.apache.struts2.json.JSONWriter can not access a member of class
偶遇一个问题:org.apache.struts2.json.JSONWriter can not access a member of class org.apache.tomcat.dbcp.db ...
随机推荐
- python基础===如何优雅的写代码(转自网络)
本文是Raymond Hettinger在2013年美国PyCon演讲的笔记(视频, 幻灯片). 示例代码和引用的语录都来自Raymond的演讲.这是我按我的理解整理出来的,希望你们理解起来跟我一样顺 ...
- Development tools[重点]
Development tools yum groupinfo "Development tools" Loaded plugins: product-id, security, ...
- [LabVIEW架构]ActorFramework(二)
前言 在上一个文章中,我们介绍了一下LabVIEW中AF的基本概念,本讲将以上一次的例子来讲解LabVIEW中的实现 正文 范例说明 假定两个人,一个作为老师,一个作为学生.学生每天早上给老师发送一封 ...
- Xcode7 iOS9.0 的真机调试
Xcode7的真机调试: 1.Xcode偏好 -> 账号 -> 增加 Apple ID ->显示 free 2.Target 运行 iOS 版本号 3.修正 Team 项 选择 ...
- MySQL:按后缀缀批量删除表格
Select CONCAT( 'drop table ', table_name, ';' ) FROM information_schema.tables Where table_schema='s ...
- tab切换 jQuery
$('p.guidan-load1').click(function(){ $("p.guidan-load1").removeClass("guidan-load12& ...
- 根据C# 事件思想来实现 php 事件
事件定义 当我们使用委托场景时,我们很希望有这样两个角色出现:广播者和订阅者.我们需要这两个角色来实现订阅和广播这种很常见的场景. 广播者这个角色应该有这样的功能:包括一个委托字段,通过调用委托来发出 ...
- datetimepicker时间控件
喜欢上datetimepicker源自于对bootstrap的喜欢. 一款简单到爆的时间空间 引入jq 引入bootstrap 引入datetimepicker和bootstrap-datetimep ...
- 四十三 常用内建模块 base64
Base64是一种用64个字符来表示任意二进制数据的方法. 用记事本打开exe.jpg.pdf这些文件时,我们都会看到一大堆乱码,因为二进制文件包含很多无法显示和打印的字符,所以,如果要让记事本这样的 ...
- javascript 中利用正则匹配 时间
本文从百度知道回来中粘贴过来,当做一个笔记,因为,说的很详细 最简单的正则 如 : \d{4}-\d{2}-\d{2}但是实际情况却不是那么简单,,要考虑,有效性和闰年等问题..... 对于日期的有效 ...