/*
#include <iostream>
using namespace std;
// public, private, protected
class student {
public:
int a, b, c;
student(); // constructor
student(int a, int b, int c); // constructor
int function1(int n);
int function1(char n);
private:
int d, e, f;
void function2(int k);
};
student::student() {}
student::student(int a, int b, int c) {}
int student::function1(int n) {
return a+b+c;
}
int main()
{
student s;
s.a = 10;
s.b = 20;
s.c = 30;
cout << s.function1(10);
//
// cin >> a >> b;
// cout << a << " " << b;
return 0;
}
*/
/*
#include <iostream>
using namespace std;
class Circle {
public:
int radius;
Circle();
Circle(int r);
double getArea();
};
Circle::Circle(){
radius = 1;
cout << "반지름 " << radius << " 원 생성" << endl;
}
Circle::Circle(int r){
radius = r;
cout << "반지름 " << radius << " 원 생성" << endl;
}
double Circle::getArea() {
return 3.14*radius*radius;
}
int main() {
Circle donut;
// donut.radius = 1;
double area = donut.getArea();
cout << "donut 면적은" << area << endl;
Circle pizza(30);
// pizza.radius = 30;
area = pizza.getArea();
cout << "pizza 면적은" << area << endl;
}
*/
/*
#include <iostream>
using namespace std;
class Rectangle{
public:
int width, height;
int getArea();
};
int Rectangle::getArea(){
return width*height;
}
int main(){
Rectangle rect;
rect.width = 3;
rect.height = 5;
cout << "사각형의 면적은 " << rect.getArea() << endl;
}
*/
/*
#include <iostream>
using namespace std;
class Circle{
public:
int radius;
Circle();
Circle(int r);
double getArea();
};
Circle::Circle() : Circle(1) { }
Circle::Circle(int r){
radius = r;
cout << "반지름 " << radius << " 원 생성" << endl;
}
double Circle::getArea() {
return 3.14*radius*radius;
}
int main(){
Circle donut;
double area = donut.getArea();
cout << "donut 면적은 " << area << endl;
Circle pizza(30);
area = pizza.getArea();
cout << "pizza 면적은 " << area << endl;
}
*/
/*
#include <iostream>
using namespace std;
class Point{
int x, y;
public:
Point();
Point(int a, int b);
void show() { cout << "(" << x << ", " << y << ")" << endl; }
};
Point::Point() : Point(0, 0) { }
Point::Point(int a, int b)
: x(a), y(b) {}
int main(){
Point origin;
Point target(10, 20);
origin.show();
target.show();
}
*/
/*
#include <iostream>
using namespace std;
class Rectangle{
public:
int width, height;
Rectangle();
Rectangle(int w, int h);
Rectangle(int length);
bool isSquare();
};
Rectangle::Rectangle(){
width = height = 1;
}
Rectangle::Rectangle(int w, int h){
width = w; height = h;
}
Rectangle::Rectangle(int length){
width = height = length;
}
bool Rectangle::isSquare(){
if(width == height) return true;
else return false;
}
int main(){
Rectangle rect1;
Rectangle rect2(3,5);
Rectangle rect3(3);
if(rect1.isSquare()) cout << "rect1은 정사각형이다." << endl;
if(rect2.isSquare()) cout << "rect2는 정사각형이다." << endl;
if(rect3.isSquare()) cout << "rect3는 정사각형이다." << endl;
}
*/