# Rectangle.cpp ```cpp= #include<stdio.h> class Rectangle { // 定義一個 Rectangle 類型 public: int width; int height; int area() { return width * height; } }; int main() { Rectangle r; // 宣告一個 Rectangle 「物件」,名字叫做 r r.width = 3; r.height = 4; printf("%d\n", r.area()); return 0; } ```
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up