![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C++学习之路
文章平均质量分 78
RIPwangh
山东理工大学本科学生
展开
-
C++学习之路---构造函数--1
感觉构造函数像定义的初始化,构造函数是每个函数都有的,如果自己没有去定义的话,系统会给你一个构造函数,析构函数也是这样的,但是他不会给你初始化的值的一 : 构造函数有这几个特点: 1. 函数名字和类名相同 2.没有返回值 3.要在public权限下 4.自动调用---(在定义变量的时) 5.不能被继承 6.可以重载 7.默原创 2015-10-08 16:49:53 · 471 阅读 · 0 评论 -
C++学习---析构函数-2
析构函数是系统收回内存做的操作,遵循先构造的后析构原则,静态内存区的最后析构 #include using namespace std;class T{ public: T(int n) { num = n; cout<<"num"<<num<<" "<<"构造"<<endl; } ~T() {原创 2015-10-08 17:13:11 · 368 阅读 · 0 评论 -
C++ 关于重载
#include #include #include #include #include using namespace std;class Complex{ public: Complex(){real = 0; imag = 0;} Complex(double r,double i){real = r; imag = i;} void原创 2015-12-17 17:09:12 · 356 阅读 · 0 评论 -
C++文件的操作
#include#include#include#include#include#includeusing namespace std;int main()///对ASCLL文件的操作{ int a[10]; ofstream outfile("f1.dat",ios::out); if(!outfile) {原创 2015-12-03 16:40:48 · 642 阅读 · 0 评论