11 2022 档案

摘要://#include<iostream> //using namespace std; // //class Ten //{ //private: // static int c; //当静态成员函数在私有成员下定义,类外不可对其进行访问 //public: // static int a; //静 阅读全文
posted @ 2022-11-24 22:15 努力的阿坤 阅读(32) 评论(0) 推荐(0) 编辑
摘要://#include<iostream> //using namespace std; // //class Seven //{ //public: // //构造函数和析构函数不能定义为常函数 // int a; // // Seven() // { // a = 12; // } // // ~ 阅读全文
posted @ 2022-11-24 22:14 努力的阿坤 阅读(90) 评论(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 努力的阿坤 阅读(12) 评论(0) 推荐(0) 编辑
摘要://#include<iostream> //using namespace std; // //class Five //{ //public: // int n; // Five() //定义一个构造函数 // { // cout << "调用构造函数" << endl; // } // // 阅读全文
posted @ 2022-11-24 22:13 努力的阿坤 阅读(22) 评论(0) 推荐(0) 编辑
摘要://#include<iostream> //using namespace std; // //class Stu //{ //public: // int age; // float f; // //构造函数,可由系统自动调用 // Stu() //一个类中可存在多个构造函数,多个构造函数构成重 阅读全文
posted @ 2022-11-24 22:12 努力的阿坤 阅读(68) 评论(0) 推荐(0) 编辑
摘要://#include<iostream> //using namespace std; // //class Stu //{ //public: // int age; // float f; // //构造函数,可由系统自动调用 // Stu() //构造函数的函数名与类名相同,构造函数没有返回值 阅读全文
posted @ 2022-11-24 22:12 努力的阿坤 阅读(21) 评论(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 努力的阿坤 阅读(33) 评论(0) 推荐(0) 编辑
摘要://#include<iostream> //using namespace std; // //class Three //{ //private: // int a; //public: // //protected: //protected在类外不可见 // //仅可在自己所在的类和自己所在类 阅读全文
posted @ 2022-11-22 21:55 努力的阿坤 阅读(76) 评论(0) 推荐(0) 编辑
摘要://#include<iostream> //using namespace std; // //class Second //{ // //访问修饰符的作用,提高代码的安全性 //private://私有成员,只被该类的内部所调用,类内若不写其他的修饰符,则默认privat,在private中的成 阅读全文
posted @ 2022-11-22 21:54 努力的阿坤 阅读(36) 评论(0) 推荐(0) 编辑
摘要://#include<iostream> //using namespace std; // //class First //在C++中,struck结构体是一个特殊的类 // //在类中,默认的访问修饰符为private;在struck结构体中,默认为punlic //{ // //类中要有成员, 阅读全文
posted @ 2022-11-22 21:53 努力的阿坤 阅读(42) 评论(0) 推荐(0) 编辑
摘要://#include<iostream> //using namespace std; //void swap(int& a1, int& b1)//该情况下,将主函数中的a和b分别传递给了a1和b1,在引用的作用下,a和a1,b和b1分别共用一个空间, //{ // int t = a1; //在 阅读全文
posted @ 2022-11-22 21:52 努力的阿坤 阅读(70) 评论(0) 推荐(0) 编辑
摘要://#include<iostream>//using namespace std; // //int& fun()//注意类型要保持一致 //{ // int a = 12;//不能引用局部变量 // return a; //} // //int main() //{ // int& b = fu 阅读全文
posted @ 2022-11-22 21:50 努力的阿坤 阅读(18) 评论(0) 推荐(0) 编辑
摘要://#include<iostream>//using namespace std;////int main()//{// ////使用new申请一个新的空间// ////int* p1 = new int; //申请一个新的空间,new+type 后面的类型要和前面的匹配// //int* p1 阅读全文
posted @ 2022-11-22 21:48 努力的阿坤 阅读(20) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示