7.13-20The first week:Learning experience

7.13-20The first week:Learning experience

vector

vector’s function is copy elements

#inlcude<vector>
int mian(){
vector<Man>men;
men[0].push_back(liuBei);  //men.pop()
//men[0] is different with liuBei,and it is copy of liuBei
men[0].getcount();
liuBei.getcount()}

static

The static function of class can’t access instance objects and instance data members.

inherit

Only two function can’t to inherit:constructor and destructor

subclass/superclass’s constructor and destructor

1.The constructor of static data members
2.The constructor of superclass
3. …of non-static data members
4. …of subclass
Tips:The destructor is converse.

文件流定位

#include <fstream>
#include <string>
#include <fstream>

using namespace std;

int main(void) {
	ifstream infile;
	infile.open("定位.cpp");
	if (!infile.is_open()) {
		return 1;
	}
// seekg:设置输入流的位置
// seekp:设置输出流的位置
	infile.seekg(0, infile.end);
// tellg:返回该输入流的当前位置(距离文件的起始位置的偏移量)
	cout<<infile.tellg()<<endl;

	system("pause");
	return 0;
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值