![](https://img-blog.csdnimg.cn/20201014180756926.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C++
weixin_43475064
这个作者很懒,什么都没留下…
展开
-
2.构造函数,析构函数,拷贝构造函数
1.定义一个类,系统会自动添加 6 个函数,如果写了就不添加 class Empty { }; class Empty { public: Empty(){ } Empty(const Empty & e){ } Empty & operator=(const Empty & e){return *this;} ~Empty(){ } Empty * operator&(){return this;} const Empty *operator&()const {原创 2020-10-30 23:17:24 · 66 阅读 · 0 评论 -
1.C和C++语法区别和类的定义
1.C和C++语法上的一些区别 1)输入输出 C:scanf("%d",&a); printf(“a = %d \n”,a); C++: cin >> a ; cout << "a = " << a << endl; C有格式控制符 2)常量 #define MAX 10 没有类型,不分配空间,在预编译时替换 enum{ MAX = 10 }; const int MAX = 10 ; 有类型,分配空间,在编译时替换 3)引用 int a = 10;原创 2020-10-24 22:20:26 · 238 阅读 · 0 评论