摘要: //#include<iostream> //using namespace std; // //class Ten //{ //private: // static int c; //当静态成员函数在私有成员下定义,类外不可对其进行访问 //public: // static int a; //静 阅读全文
posted @ 2022-11-24 22:15 努力的阿坤 阅读(37) 评论(0) 推荐(0)
摘要: //#include<iostream> //using namespace std; // //class Seven //{ //public: // //构造函数和析构函数不能定义为常函数 // int a; // // Seven() // { // a = 12; // } // // ~ 阅读全文
posted @ 2022-11-24 22:14 努力的阿坤 阅读(96) 评论(0) 推荐(0)
摘要: //#include<iostream> //using namespace std; // //class Six //{ //public: // int a; // Six(int a) // { //用this指针来区分局部变量和成员变量 // this->a = a; //this指针对应 阅读全文
posted @ 2022-11-24 22:14 努力的阿坤 阅读(17) 评论(0) 推荐(0)
摘要: //#include<iostream> //using namespace std; // //class Five //{ //public: // int n; // Five() //定义一个构造函数 // { // cout << "调用构造函数" << endl; // } // // 阅读全文
posted @ 2022-11-24 22:13 努力的阿坤 阅读(28) 评论(0) 推荐(0)
摘要: //#include<iostream> //using namespace std; // //class Stu //{ //public: // int age; // float f; // //构造函数,可由系统自动调用 // Stu() //一个类中可存在多个构造函数,多个构造函数构成重 阅读全文
posted @ 2022-11-24 22:12 努力的阿坤 阅读(74) 评论(0) 推荐(0)
摘要: //#include<iostream> //using namespace std; // //class Stu //{ //public: // int age; // float f; // //构造函数,可由系统自动调用 // Stu() //构造函数的函数名与类名相同,构造函数没有返回值 阅读全文
posted @ 2022-11-24 22:12 努力的阿坤 阅读(28) 评论(0) 推荐(0)
摘要: //#include<iostream> //using namespace std; // //class Stu //{ //protected: //private: // int age; // void fun() // { // age = 12; // cout << age << e 阅读全文
posted @ 2022-11-24 22:11 努力的阿坤 阅读(37) 评论(0) 推荐(0)