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 · 249 阅读 · 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 · 312 阅读 · 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 · 350 阅读 · 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 · 213 阅读 · 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 · 264 阅读 · 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 · 199 阅读 · 0 评论 -
2018.5.30(类的静态成员)
菜鸟教程: https://m.runoob.com/cplusplus/cpp-static-members.html 我们可以使用 static 关键字来把类成员定义为静态的。当我们声明类的成员为静态时,这意味着无论创建多少个类的对象,静态成员都只有一个副本。 静态成员在类的所有对象中是共享的。如果不存在其他的初始化语句,在创建第一个对象时,所有的静态数据都会被初始化为零。我们不能把静态...原创 2018-05-30 21:51:48 · 230 阅读 · 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 · 889 阅读 · 0 评论 -
2018.6.8(用sscanf,strtok读入数据)
sscanf()和正则表达式 https://blog.youkuaiyun.com/kenby/article/details/4051018 strtok http://www.cnblogs.com/aduck/articles/2245364.html C语言itoa()函数和atoi()函数详解(整数转字符C实现) https://www.cnblogs.com/bluestorm/p/3...原创 2018-06-08 21:16:35 · 294 阅读 · 0 评论
分享