摘要:
#include <iostream> class Person { public: int age_get() { return m_age; } void age_set(int age) { m_age = age; } Person operator+(Person &person) { P 阅读全文
摘要:
操作流程: 启动系统; 长按【shift】进入GRUB界面; 选择Advanced options for Ubuntu,进入; 选择recovery mode,按【e】进入编辑界面; 翻到最后,将ro recovery nomodeset所在行中,ro改为rw; 按下【ctrl + x】重启系统。 阅读全文
摘要:
#include <iostream> class Person { //print是Person朋友 可以访问类中私有内容 friend void print(Person &person); public: Person(int age): age(age), sex(0) { } public 阅读全文
摘要:
#include <iostream> class Person { public: //解决名称冲突 void age_set(int age) { //this指针指向 被调用的成员函数 所属的对象 this->age = age; } Person &age_add(int age) { th 阅读全文
摘要:
#include <iostream> //每个空对象也分配1个字节空间,区分空对象内存位置。每个空对象也有一个独一无二的内存地址 class Person { }; class Student { //静态成员不属于类对象 static int voice; static void func(); 阅读全文
摘要:
class Person { public: Person() { std::cout << "Person()构造" << std::endl; } ~Person() { std::cout << "~Person()析构" << std::endl; } int age_get() { ret 阅读全文
摘要:
#include <iostream> using namespace std; int main() { char buf[] = {1, 3, 4, 2, 6, 5}; int start = 0; int end = sizeof(buf) - 1; while(start < end) { 阅读全文
摘要:
include <boost/shared_ptr.hpp> using namespace std; class Student { private: string name; public: Student(string name) : name(name) { cout << "Student 阅读全文