C++中类的各种方法总结

说明:student为类名

普通方法

bool student::set(int a)

构造方法

  • 不带参数
student::student()
  • 带参数
student::student(int a, string b)

析构方法(用于销毁对象,节省内存)

student::~student()

常成员方法(只读不写)

bool student::read() const

静态成员方法(依赖于类,不依赖于任何一个对象)

stacic int count()

你可能感兴趣的:(C++,c++,开发语言,后端)