上一页 1 ··· 9 10 11 12 13 14 15 16 17 ··· 112 下一页
摘要: #include <iostream> class Animal { public: virtual void talk() { std::cout << "Animal talk" << std::endl; } }; class Dog: public Animal { public: void 阅读全文
posted @ 2022-07-06 19:05 thomas_blog 阅读(18) 评论(0) 推荐(0) 编辑
摘要: #include <iostream> class Person { public: static int age; }; class Student: public Person { public: static int age; int grade; }; int Person::age = 5 阅读全文
posted @ 2022-07-06 17:32 thomas_blog 阅读(15) 评论(0) 推荐(0) 编辑
摘要: #include <iostream> class Person { public: Person(int age): m_age(age) { } ~Person() { } void func() { std::cout << "Person func" << std::endl; } void 阅读全文
posted @ 2022-06-30 21:38 thomas_blog 阅读(15) 评论(0) 推荐(0) 编辑
摘要: #include <iostream> class Person { public: Person() { std::cout << "Person" << std::endl; } ~Person() { std::cout << "~Person" << std::endl; } private 阅读全文
posted @ 2022-06-30 21:15 thomas_blog 阅读(15) 评论(0) 推荐(0) 编辑
摘要: class Person { private: int age; char sex; }; class Student: public Person { private: int cid; }; > cl /d1 reportSingleClassLayoutStudent D:\ConsoleAp 阅读全文
posted @ 2022-06-30 14:27 thomas_blog 阅读(6) 评论(0) 推荐(0) 编辑
摘要: #include <iostream> class Add { public: int operator()(int a, int b) { std::cout << "operator()" << std::endl; return a + b; } }; int main() { using n 阅读全文
posted @ 2022-06-29 12:00 thomas_blog 阅读(18) 评论(0) 推荐(0) 编辑
摘要: #include <iostream> class Person { public: Person(std::string name, int age): m_age(age), m_name(name) { } bool operator==(Person &person) { std::cout 阅读全文
posted @ 2022-06-27 18:22 thomas_blog 阅读(16) 评论(0) 推荐(0) 编辑
摘要: #include <iostream> class Person { public: Person() { m_age = NULL; } Person(int age) { std::cout << "Person " << this << std::endl; m_age = new(int); 阅读全文
posted @ 2022-06-27 13:29 thomas_blog 阅读(19) 评论(0) 推荐(0) 编辑
摘要: #include <iostream> class Person { public: void age_set(int age) { m_age = age; } int age_get() { return m_age; } /* 前置++ */ Person &operator++() { ++ 阅读全文
posted @ 2022-06-13 18:06 thomas_blog 阅读(29) 评论(1) 推荐(1) 编辑
摘要: class Person { friend std::ostream &operator<<(std::ostream &out, Person &person); public: void name_set(const std::string &name) { m_name = name; } v 阅读全文
posted @ 2022-06-13 17:33 thomas_blog 阅读(30) 评论(0) 推荐(0) 编辑
上一页 1 ··· 9 10 11 12 13 14 15 16 17 ··· 112 下一页