Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

JavaStudy2003/세번째수업: Difference between revisions

From ZeroWiki
imported>Unknown
No edit summary
 
(Repair MoniWiki formatting after migration)
 
(One intermediate revision by the same user not shown)
Line 19: Line 19:
|-
|-
| 창재 & 수민 Pair
| 창재 & 수민 Pair
| [[:File:JavaStudy2003.zip|JavaStudy2003.zip]]
| [[JavaStudy2003]].zip
|}
|}

Latest revision as of 00:34, 29 March 2026

오버로딩(Overloading) 및 리팩토링

  • 오버로딩 - C++에서 cin을 cin.get(), cin.get(ch), cin.get(ch,50) 이렇게 쓰는 것처럼 같은 이름의 함수로 비슷한 기능의 역할을 하는 함수들을 만들었다.
	public Circle(int xValue, int yValue, int width, int height) {
		middlePoint = new Point(xValue, yValue);
		this.width = width;
		this.height = height;
	}
	
	public Circle(int xValue, int yValue, int r){
		middlePoint = new Point(xValue, yValue);
		this.width = r;
		this.height = r;
	}
  • 또 Point(int xValue, int yValue) -> 같이 전달인자를 바로 넣어주어서 보다 간편하게 자료를 입력받을 수 있게 했다.
창재 & 수민 Pair JavaStudy2003.zip