![](https://img-blog.csdnimg.cn/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C++面向对象程序设计
MElephant-L
以己之力,追吾所愿
展开
-
2018.5.21(&,const,函数重载,缺省函数)
引用类型名 & 引用名=某变量名int n=1;int &r=n;r=4;cout<<r;//输出4;cout<<n;//输出4;n=5;cout<<r;//输出5;定义常量–const 动态内存分配#include<iostream>#include<cstdio>usi...原创 2018-05-21 21:58:31 · 171 阅读 · 0 评论 -
2018.5.21(用class 计算矩形的面积、周长)
#include<iostream>#include<cstdio>using namespace std;class Rectangle{private: int w,h;public: int Area() { return w*h; } int C() { return 2*...原创 2018-05-21 22:01:41 · 261 阅读 · 0 评论 -
2018.6.3(运算符重载)
视频教程(北大mooc): https://www.icourse163.org/learn/PKU-1002029030?tid=1002785058#/learn/content?type=detail&id=1003870385&cid=1004682687&replay=true 菜鸟教程: http://www.runoob.com/cplusplus/cp...原创 2018-06-03 20:19:42 · 259 阅读 · 0 评论 -
2018.5.23(c++面向对象--复制构造函数)
复制构造函数#include&amp;lt;iostream&amp;gt;#include&amp;lt;cstdio&amp;gt;using namespace std;class Test{public: double real,image;public: Test ()//无参构造函数 { }; Test (double n)//含有一个参数的构造函数 ...原创 2018-05-23 21:55:44 · 147 阅读 · 0 评论 -
2018.6.4(public继承的赋值兼容规则)
https://www.icourse163.org/learn/PKU-1002029030?tid=1002785058#/learn/content?type=detail&amp;id=1003870398&amp;cid=1004682699&amp;replay=true#include&lt;iostream&gt;#include&lt;cstdio&gt;using na原创 2018-06-04 21:43:00 · 172 阅读 · 0 评论 -
2018.5.30(this指针)
this指针:#include<iostream>#include<cstdio>using namespace std;class Text{private: int length,breadth,height;public: Text(int l,int b,int h); int Volume(); int com...原创 2018-05-30 21:49:48 · 139 阅读 · 0 评论 -
2018.5.30(类的静态成员)
菜鸟教程: https://m.runoob.com/cplusplus/cpp-static-members.html我们可以使用 static 关键字来把类成员定义为静态的。当我们声明类的成员为静态时,这意味着无论创建多少个类的对象,静态成员都只有一个副本。静态成员在类的所有对象中是共享的。如果不存在其他的初始化语句,在创建第一个对象时,所有的静态数据都会被初始化为零。我们不能把静态...原创 2018-05-30 21:51:48 · 151 阅读 · 0 评论 -
2018.6.7(多态性----几何形体处理程序----mooc)
#include&amp;lt;iostream&amp;gt;#include&amp;lt;cstdio&amp;gt;#include&amp;lt;cmath&amp;gt;#include&amp;lt;cstdlib&amp;gt;using namespace std;class Shape{public: virtual do原创 2018-06-07 21:34:10 · 767 阅读 · 0 评论 -
2018.6.8(用sscanf,strtok读入数据)
sscanf()和正则表达式 https://blog.csdn.net/kenby/article/details/4051018strtok http://www.cnblogs.com/aduck/articles/2245364.htmlC语言itoa()函数和atoi()函数详解(整数转字符C实现) https://www.cnblogs.com/bluestorm/p/3...原创 2018-06-08 21:16:35 · 218 阅读 · 0 评论