반응형

2016/12/05 5

[설계 패턴 C#] 15. 책임 연쇄 패턴(Chain of Responsibility Pattern)

15. 책임 연쇄 패턴(Chain of Responsibility Pattern) "본문 내용"[Escort GoF의 디자인 패턴]15. 책임 연쇄 패턴(Chain of Responsibility Pattern)[Escort GoF의 디자인 패턴] 15. 책임 연쇄 패턴(Chain of Responsibility Pattern) 설계[Escort GoF의 디자인 패턴] 15. 책임 연쇄 패턴(Chain of Responsibility Pattern) 구현 ▶ ChangeHandler.csusing System.Collections.Generic; namespace ChainofResponsibility{ abstract class ChangeHandler { public ChangeHandler Succ..

[Java 소스] 정보 은닉을 하지 않았을 때

[Java 소스] 정보 은닉을 하지 않았을 때 public class Unit { public int hp; public Unit(){ hp = 0; }}public class Program { public static void main(String[] args){ Unit unit = new Unit(); System.out.println("유닛의 체력:"+unit.hp); unit.hp += 50; System.out.println("유닛의 체력:"+unit.hp); unit.hp += 70; System.out.println("유닛의 체력:"+unit.hp); } } 실행 결과유닛의 체력:0유닛의 체력:50 유닛의 체력:120 본문 [Java] 4. 2 접근 지정자

[Java 소스] 캡슐화 개요

[Java 소스] 캡슐화 개요 public class Musician { String name; int skill; int num; public Musician(String name,int num){ this.name = name; this.num = num; skill = 0; } public void introduce(){ System.out.println("이름:"+name+" 번호:"+num +" 스킬:"+skill); } public void play(){ System.out.println("이름:"+name+" 연주하다."); skill++; } public String getName(){ return name; } public int getSkill(){ return skill; } publ..

반응형