| #include<iostream> using namespace std; class Rectangle { private: int width, height, area; public: Rectangle(int w=5, int h=10) {width=w; height=h;} void setRectangle(int w, int h) {width=w; height=h;} void calcArea(){area=width*height;} int getArea(){return area;} void print(); }; void Rectangle::print() { cout<<"가로 : "<< width << ",세로 : " << height << ",넓이" << area <<endl; } void main() { Rectangle r; r.calcArea(); r.print(); } |
| 번호 | 분류 | 제목 |
|---|---|---|
| 22 | C언어 |
예제4(Ver.2)
|
| 21 | C언어 |
ex1
|
| 20 | C언어 |
3-28
|
| » | C언어 | Rectangle |
| 18 | C언어 | Rectangle2 |
| 17 | C언어 | Rectangle3 |
| 16 | C언어 | Rectangle4 |
| 15 | C언어 |
Rectangle 객체배열
|
| 14 | C언어 | 동적메모리 |
| 13 | C언어 | BMI |
| 12 | C언어 | 예제1 |
| 11 | C언어 | Chicken 클래스 |
| 10 | C언어 | Animal 클래스 |
| 9 | C언어 | 도형의 상속구조 |
| 8 | C언어 | 가상함수(Shape 클래스) |