c++中implicit members

来源:互联网 发布:仓管员工作软件 编辑:程序博客网 时间:2024/06/05 18:11
#include <iostream>#include <string>using namespace std;class Rectangle {    int width, height;public:    Rectangle (int x, int y) : width(x), height(y) {}    Rectangle () = default;    Rectangle (const Rectangle& other) = delete;    int area () {return width*height;} };int main(int argc, char const *argv[]){    Rectangle foo;    Rectangle bar (10, 20);    cout << "bar's area: " << bar.area() << endl;    return 0;}
原创粉丝点击