摘要: 1.简单工厂模式 #include <bits/stdc++.h> using namespace std; class produce { private: int width; int height; public: produce(int width,int height):width(wid 阅读全文
posted @ 2023-09-07 20:52 SuperTonyy 阅读(49) 评论(0) 推荐(0)
摘要: #include <bits/stdc++.h> using namespace std; class String { public: String(const char* str = NULL){// 普通构造函数 cout << "普通构造函数被调用" << endl; if (str == 阅读全文
posted @ 2023-09-07 15:56 SuperTonyy 阅读(66) 评论(0) 推荐(0)
摘要: #include <bits/stdc++.h> using namespace std; class animal { public: // 纯虚函数 // virtual void sound() = 0; // 虚函数 virtual void sound() { cout << "anima 阅读全文
posted @ 2023-09-07 15:06 SuperTonyy 阅读(18) 评论(0) 推荐(0)
摘要: #include <bits/stdc++.h> using namespace std; class student { private: char* name; public: student() { name = new char(20); cout << "创建student" << end 阅读全文
posted @ 2023-09-07 14:00 SuperTonyy 阅读(14) 评论(0) 推荐(0)