#include<iostream>
using namespace std;
class Base
{
public:
Base(){
cout<<"hello"<<endl;
}
Base (int _a ):base(_a){ // 将a赋值给base
base++;
cout << base << endl;
}
Base (int _a ,float _b):base(_a),th(_b){
cout << base + th << endl;
}
Base (int _a ,float _b ,int _c):base(_a),th(_b),xh(_c){
cout << base + th + xh<< endl;
} void fun0(){cout << base << endl;}
int base;
float th;
int xh;
};
int main(){
Base b; // 调用默认构造函数
Base t(10); // 调用带参的构造函数的简写形式
t.fun0();
t.base=100;
t.fun0();
Base t1 =Base(100,88.12); // 调用带参的构造函数
Base t2 =(10,100.12,20); //
}

注意:Base t2 =(10,100.12,20); 在乌班图下输出的结果为错误的。

最新文章

  1. VMware安装CentOS
  2. 细说;(function ($, undefined){ })(jQuery); 的使用
  3. java.lang.RuntimeException: Method setUp in android.test.ApplicationTestCase not mocked. See http://g.co/androidstudio/not-mocked for details.
  4. html-5 --html5教程article、footer、header、nav、section使用
  5. poj 3237 Tree
  6. hdu 4778 Gems Fight! 博弈+状态dp+搜索
  7. android 在Fragment里添加Theme主题
  8. LightOj 1230 Placing Lampposts(树形DP)
  9. LeetCode :: Insertion Sort List [具体分析]
  10. 关于boostrap的thead固定tbody滚动
  11. BZOJ USACO 银组 水题集锦
  12. [转][RabbitMQ+Python入门经典] 兔子和兔子窝
  13. JDK各个版本的新特性
  14. eclipse中的项目为什么无法添加到tomcat中?
  15. [nodejs] nodejs开发个人博客(一)准备工作
  16. Spring AOP详细介绍
  17. treap学习笔记
  18. MySQL存储过程 事务transaction
  19. keras环境
  20. WCF无法引入Model实体解决方案

热门文章

  1. CF1353D Constructing the Array(优先队列)
  2. JVM调优总结(七)-调优方法
  3. Ant标签详解--基础操作
  4. [译] 制作 Vue 3 的过程
  5. 括号树 noip(csp??) 2019 洛谷 P5658
  6. Python连接不上SQL Server的两种根治思路
  7. java方式实现基数排序
  8. redis未授权漏洞和主从复制rce漏洞利用
  9. 使用ADMT和PES实现window AD账户跨域迁移-介绍篇
  10. Docker容器同步主机时间