摘要: 1 #include <iostream> 2 #include <string> 3 using namespace std; 4 //汽车类 5 class Car 6 { 7 public: 8 Car(); 9 Car(string name) 10 { 11 cout << "Car带参构 阅读全文
posted @ 2021-03-13 18:14 丁帅帅dss 阅读(94) 评论(0) 推荐(0)
摘要: 1 #include <iostream> 2 #include <cstring> 3 using namespace std; 4 class Person 5 { 6 public: 7 Person() 8 { 9 cout << "无参构造" << endl; 10 } 11 Person 阅读全文
posted @ 2021-03-13 18:13 丁帅帅dss 阅读(65) 评论(0) 推荐(0)
摘要: #include <iostream> #include <cstring> using namespace std; class Person { public: Person() { cout << "构造函数调用" << endl; pName = (char *)malloc(sizeof( 阅读全文
posted @ 2021-03-13 18:12 丁帅帅dss 阅读(69) 评论(0) 推荐(0)
摘要: 1 #include<iostream> 2 using namespace std; 3 class Point 4 { 5 public: 6 void setX(int x) 7 { 8 mX = x; 9 } 10 void setY(int y) 11 { 12 mY = y; 13 } 阅读全文
posted @ 2021-03-13 18:11 丁帅帅dss 阅读(146) 评论(0) 推荐(1)
摘要: 1 //设计立方体类(Cube),求出立方体的面积(2 * a*b + 2 * a*c + 2 * b*c)和体积(a * b * c), 2 //分别用全局函数和成员函数判断两个立方体是否相等。 3 #include <iostream> 4 using namespace std; 5 clas 阅读全文
posted @ 2021-03-13 18:10 丁帅帅dss 阅读(134) 评论(0) 推荐(0)