반응형
#include <iostream>
 
using namespace std;
 
class CRect
{
 private :
     int left;
     int top;
     int right;
     int bottom;
 public :
     void prn();
     void SetRect();
};

void CRect::prn()
{
	cout << " left : " << left;
	cout << "\n top : " << top;
	cout << "\n right : " << right;
	cout << "\n bottom : " << bottom;
}
void CRect::SetRect()
{
	left = 10;
	top = 20;
	right = 30;
	bottom = 40;
}
void main(void)
{
	CRect val1;
	
	val1.SetRect();
	val1.prn();
	cout << endl;
	cout << endl;
}


반응형

'프로그래밍 공부 > C++' 카테고리의 다른 글

- 클래스, 객체문제  (0) 2016.03.20
- 문자열 반전출력  (0) 2016.03.20
- 문자열 길이 출력  (0) 2016.03.20
- 구조체 총점,평균 구하기  (0) 2016.03.20
- 구조체 초기화  (0) 2016.03.20
Posted by 메가아재
,