![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
c++
小丑jockey
这个作者很懒,什么都没留下…
展开
-
引入this
#include<iostream> #include<string> using namespace std; struct student { string xuehao() { return No; } string No; }; int main() { student xiaohong; cin >> xiaohong.No; ...原创 2019-01-24 23:18:50 · 133 阅读 · 0 评论 -
c++中private,protected,public
基类的共有成员 基类的受保护成员 基类的私有成员 派生类的共有成员 派生类的受保护成员 派生类的私有成员 派生类的成员函数 可访问 可访问 不可访问 ...原创 2019-04-27 08:38:38 · 150 阅读 · 0 评论 -
c++输入输出流运算符的重载
说明:输入输出运算符的重载必须为友元函数,并且必须有输入输出流的返回值,固定格式为: friend istream& operator >> (istream&, 重载类名&); friend ostream& operator << (ostream&,重载类名&); 测试代码: #include<io...原创 2019-04-27 09:18:23 · 5504 阅读 · 1 评论 -
c++ new 和allocator
//c++提供了两种一次分配一个对象数组的方法。 //①new,可以分配并初始化一个对象数组。 //②标准库包含一个名为allocator的类,允许我们将分配和初始化进行分离。使用allocator通常会提供 //更好的性能和更灵活的内存管理能力。 //当一个应用需要可变数量的对象时 //大多数应用应该使用标准库容器而不是动态分配的数组。使用容器更为简单、更不容易出现内存管理错误并且具有更好的性...原创 2019-05-01 17:07:34 · 587 阅读 · 0 评论 -
c++输入输出流运算符的重载测试代码
#pragma once #include<iostream> using namespace std; class Data { private: int year; int month; int day; public: Data(int year=0,int month=0,int day=0) :year(year),month(month),day(day){} ...原创 2019-05-02 09:24:22 · 208 阅读 · 0 评论