类的定义和声明
#include
#include
using namespace std;
class Complex
{
friend istream& operator>>(istream &in, Complex &c);
friend ostream& operator<<(ostream &out, const Complex &c);
friend Com...
分类:
编程语言 时间:
2015-06-07 09:49:23
阅读次数:
179
在xcode中编译oc和c++代码时出现如下错误:Undefined symbols for architecture armv7"std::basic_ostream >& std::operator, std::allocator >(std::basic_ostream >&, std::ba...
分类:
其他好文 时间:
2015-05-29 20:18:50
阅读次数:
177
前言:c++的文件流处理其实很简单,前提是你能够理解它。文件流本质是利用了一个buffer中间层。有点类似标准输出和标准输入一样。c++ IO的设计保证IO效率,同时又兼顾封装性和易用性。本文将会讲述c++文件流的用法。有错误和疏漏的地方,欢迎批评指证。需要包含的头文件: 名字空间: std也可以试...
分类:
编程语言 时间:
2015-05-27 12:14:02
阅读次数:
174
C++中的输入输出分为三种:基于控制台的I/O,即istream、ostream、iostream;基于文件的I/O,即ifstream、ofstream、fstream;基于字符串的I/O,即istringstream、ostringstream、stringstream. C++引入了ostri...
分类:
其他好文 时间:
2015-05-16 17:58:49
阅读次数:
123
// 深赋值与浅赋值
// 浅赋值,这样的浅赋值会导致程序崩溃,与浅拷贝一个理
#include
using namespace std;
class S_Evaluate;
ostream& operator<<(ostream& out, const S_Evaluate &s);
class S_Evaluate
{
friend ostream& operator<<(ostre...
分类:
编程语言 时间:
2015-05-15 21:28:51
阅读次数:
162
// 浅拷贝与深拷贝
// 像这样的浅拷贝会导致程序崩溃,因为同一个空间被释放了两次
#include
#include
using namespace std;
class S_Copy;
ostream& operator<<(ostream& out, const S_Copy &s);
class S_Copy
{
friend ostream& operator<<(ostr...
分类:
编程语言 时间:
2015-05-15 17:41:50
阅读次数:
99
// cout重载能不能写成成员函数,若能,写出函数原型,若不能,说明原因
#include
using namespace std;
// cout做友元
class A;
ostream& operator<<(ostream &out, const A &a);
class A
{
friend ostream& operator<<(ostream &out, const A &...
分类:
编程语言 时间:
2015-05-15 15:37:01
阅读次数:
136
8.1 IO类iostream istream, wistream从流中读取数据 ostream, wostream iostream, wiostream读写流fstream ifstream, wifstream从文件中读取数据 ofstream, wofstream fstream, wfs....
分类:
其他好文 时间:
2015-05-12 22:47:53
阅读次数:
152
转载http://blog.sina.com.cn/s/blog_69dd1a090101fc59.html问题始于学习数据结构,自己编写一个单链表,其中用到了重载输出运算符 class List{2 friend std::ostream& operator & slist);3 ...
分类:
其他好文 时间:
2015-05-11 21:42:47
阅读次数:
124
ostream类重载了operatorusing namespace std;int main(){ int a=3; int *p=&a; cout<<p<<endl; //0x22fe98 cout<<&a<<endl; //0x22fe98 char *ch="hello wo...
分类:
其他好文 时间:
2015-05-10 11:23:30
阅读次数:
195