摘要: #include<iostream> using namespace std; #include<string> class animal { public: void show() { cout << "Animal"<<" " << "名称:" << name << " " << "年龄:" < 阅读全文
posted @ 2023-05-19 20:53 张佳木 阅读(44) 评论(0) 推荐(0)
摘要: #include<iostream> using namespace std; #include<string> class student { public: void shangke(); protected: string name; int bj; int id; }; class teac 阅读全文
posted @ 2023-05-18 20:45 张佳木 阅读(41) 评论(0) 推荐(0)
摘要: #include<iostream> using namespace std; #include<string> class people { public: void setValue(int m, string str) { age = m; name = str; } void display 阅读全文
posted @ 2023-05-17 20:38 张佳木 阅读(53) 评论(0) 推荐(0)
摘要: #include <iostream> using namespace std; class BaseClass { public: void fn1(); void fn2(); }; void BaseClass::fn1() { cout << "调用基类的函数fn1()" << endl; 阅读全文
posted @ 2023-05-16 20:45 张佳木 阅读(41) 评论(0) 推荐(0)
摘要: #include <iostream> using namespace std; class Object { private: int weight; public: Object() { cout << "构造Object对象" << endl; weight = 0; } int getWei 阅读全文
posted @ 2023-05-15 20:27 张佳木 阅读(49) 评论(0) 推荐(0)
摘要: class Base { public: int fn1()const {return 1;} int fn2()const {return 2;} } ; class Derived:private Base { public: int fn1() { return Base::fn1();}; 阅读全文
posted @ 2023-05-14 20:13 张佳木 阅读(59) 评论(0) 推荐(0)
摘要: #include <iostream> #include <string> using namespace std; class Document { public: Document() { } Document(char* nm); char* name; void PrintNameOf(); 阅读全文
posted @ 2023-05-13 22:24 张佳木 阅读(61) 评论(0) 推荐(0)
摘要: #include <iostream> #include <string> using namespace std; class Document { public: Document() { } Document(char* nm); char* name; void PrintNameOf(); 阅读全文
posted @ 2023-05-12 20:32 张佳木 阅读(21) 评论(0) 推荐(0)
摘要: #include <iostream> using namespace std; class BaseClass { public: BaseClass(); }; BaseClass::BaseClass() { cout << "构造基类对象!" << endl; } class Derived 阅读全文
posted @ 2023-05-11 21:26 张佳木 阅读(34) 评论(0) 推荐(0)
摘要: #include <iostream> using namespace std; enum myColor { BLACK, WHITE }; class Mammal { public: //constructors Mammal(); ~Mammal(); //accessors int get 阅读全文
posted @ 2023-05-10 20:37 张佳木 阅读(63) 评论(0) 推荐(0)