학습목표 l 생성패턴 l 동기, 목적 l 종류 l 팩토리패턴과그적용 l 싱글톤패턴과그적용 l 프로토타입패턴과그적용 l 실습문제 2

Size: px
Start display at page:

Download "학습목표 l 생성패턴 l 동기, 목적 l 종류 l 팩토리패턴과그적용 l 싱글톤패턴과그적용 l 프로토타입패턴과그적용 l 실습문제 2"

Transcription

1 객체지향설계와패턴 Lecture #9: 생성패턴 (1) Eun Man Choi

2 학습목표 l 생성패턴 l 동기, 목적 l 종류 l 팩토리패턴과그적용 l 싱글톤패턴과그적용 l 프로토타입패턴과그적용 l 실습문제 2

3 생성패턴 l 생성패턴 l 종류 l 객체의생성과정을추상화하여유연성 (flexibility) 을높인다. l 실제객체와객체생성부분을분리함으로써결합도 (coupling) 를낮춘다. l 팩토리패턴 l 싱글톤패턴 l 프로토타입패턴 l 추상팩토리패턴 l 빌더패턴 3

4 Pattern #1 - 팩토리패턴 생성자만으로는개별객체생성이적합하지않은경우 사용 l 목적 l 결과 l 객체생성을위한인터페이스를정의하는데있다. l 어떤클래스의인스턴스를생성할지에대한결정은서브클래스에서이루어지도록인스턴스의책임을미룸 l 다양한형태의객체를반환하는융통성을갖게됨 4

5 팩토리패턴을사용하는이유 l 생성자사용할때의문제 Duck duck; if (picnic) { duck = new MallardDuck(); else if (hunting) { duck = new DecoyDuck(); else if (inbathtub) { duck = new RubberDuck(); 새로운타입이추가될때문제가됨 5

6 사례 #1 - 피자스토어 Pizza orderpizza(string type){ if (type.equals( cheese )) { pizza = new CheesePizza(); else if type.equals( greek )) { pizza = new GreekPizza(); else if type.equals( pepperoni )) { pizza = new PepperoniPizza(); pizza.prepare(); pizza.bake(); pizza.cut(); pizza.box() l 만일피자스토어에서주문하는피자종류를바꾸기로결정한다면 orderpizza 메소드는바뀌어야 6

7 사례 #1- 피자스토어생성자 Pizza orderpizza(string type){ if (type.equals( cheese )) { pizza = new CheesePizza(); else if type.equals( greek )) { pizza = new GreekPizza(); else if type.equals( pepperoni )) { pizza = new PepperoniPizza(); pizza.prepare(); pizza.bake(); pizza.cut(); pizza.box() 고정된부분 변동이있을부분 7

8 사례 #1 객체생성을캡슐화 if (type.equals( cheese )) { pizza = new CheesePizza(); else if type.equals( greek )) { pizza = new GreekPizza(); else if type.equals( pepperoni )) { pizza = new PepperoniPizza(); SimplePizzaFactory 클래스가담당 8 public class SimplePizzaFactory { public Pizza createpizza(string type) { Pizza pizza = null; if (type.equals("cheese")) { pizza = new CheesePizza(); else if (type.equals("pepperoni")) { pizza = new PepperoniPizza(); else if (type.equals("clam")) { pizza = new ClamPizza(); else if (type.equals("veggie")) { pizza = new VeggiePizza(); return pizza;

9 사례 #1 PizzaStore 클래스수정 public class PizzaStore { SimplePizzaFactory factory; public PizzaStore(SimplePizzaFactory factory) { this.factory = factory; public Pizza orderpizza(string type) { Pizza pizza; pizza = factory.createpizza(type); pizza.prepare(); pizza.bake(); pizza.cut(); pizza.box(); return pizza; 9

10 SimpleFactory 전체사례 SimplePizzaFactory factory = new SimplePizzaFactory(); PizzaStore store = new PizzaStore(factory); Pizza pizza = store.orderpizza("cheese"); PizzaStore orderpizza() SimplePizzaFactory createpizza() CheesePizza Pizza prepare() bake() cut() box() VeggiePizza ClamPizza ClamPizza 10

11 여러 Factory 생성 NYPizzaFactory PizzaStore ChicagoPizzaFactory NYPizzaFactory nyfactory = new NYPizzaFactory(); PizzaStore nystore = new PizzaStore(nyFactory); Pizza pizza = nystore.orderpizza("cheese"); ChicagoPizzaFactory chicagofactory = new ChicagoPizzaFactory(); PizzaStore chicagostore = new PizzaStore(chicagoFactory); Pizza pizza = chicagostore.orderpizza("cheese"); 11

12 다른방법 추상메소드 l PizzaStore 를위한프레임워크 public abstract class PizzaStore { abstract Pizza createpizza(string item); public Pizza orderpizza(string type) { Pizza pizza = createpizza(type); pizza.prepare(); pizza.bake(); pizza.cut(); pizza.box(); return pizza; 12

13 서브클래스를정할수있게 PizzaStore createpizza() orderpizza() NYStylePizzaStore createpizza() ChicagoStylePizzaStore createpizza() l 팩토리메소드는객체생성을다루며이를서브클래스에캡슐화함 l 슈퍼클래스의클라이언트코드에서서브클래스에대하여발생하는객체생성을떼내올 (decoupled) 수있음 13

14 팩토리메소드패턴 PizzaStore createpizza() orderpizza() Creator Classes Pizza NYStylePizzaStor e createpizza() ChicagoStylePizzaStore createpizza() Product Classes NYStyleCheesePizza NYStyleCheesePizza NYStyleCheesePizza NYStyleCheesePizza ChStyleCheesePizza ChStyleCheesePizza ChStyleCheesePizza ChStyleCheesePizza 14

15 팩토리메소드패턴정의 l 팩토리메소드패턴은객체를생성하기위한인터페이스를정의한것 l 어떤클래스가인스턴스로될지는서브클래스가결정하게 l 팩토리메소드는서브클래스에게인스턴스화를연기시킨것 15

16 사례 #2 : 미로찾기 l 예제 : 컴퓨터게임미로찾기만들기 l 단순미로찾기 l 미로 (maze) 는방 (room) 과벽 (wall) 과문 (door) 으로구성 l room은동서남북각방향으로 wall이나 door가연결되어있음. l room과 room간의연결은하나의 door로연결 l maze는복수개의 room으로구성 l 클래스다이어그램 l 클래스 : Maze, Room, Wall, Door, à Room, Wall, Door 를미로의공통구성요소로간주하여 MapSite 로추상화 16

17 패턴미적용사례 l MapSite 의메소드 l Enter(): Player의위치를변경. l 만일 MapSite가 Room 객체라면 Player가있는방을변경 l 만일 MapSite 가 Door 객체라면 Door가열려져있는경우엔다른 Room으로이동할수있지만, 잠겨있을경우엔이동할수없음. à Door 가열려져있는지여부를표현하기위한속성필요 l Room 의메소드 l 동서남북각방향으로 Wall이나 Door를지정하기위한 Method 필요. à SetSide(), GetSide() l Maze 의메소드 l Room을추가하기위한 Method 필요 à AddRoom() 17

18 패턴미적용사례 l Maze 를위한클래스다이어그램 18

19 패턴미적용사례 - 코드 class MapSite { public: virtual void Enter() = 0; ; class Room : public MapSite { public: Room(int = 0); Room(const Room&); virtual Room* Clone() const; void InitializeRoomNo(int); class Wall : public MapSite { public: ; Wall(); Wall(const Wall&); virtual Wall* Clone() const; virtual void Enter(); class Door : public MapSite { public: Door(Room* = 0, Room* = 0); Door(const Room&); virtual Door* Clone() const; MapSite* GetSide(Direction); void Initialize(Room*, Room*); void SetSide(Direction, MapSite*); virtual void Enter(); private: MapSite* _sides[4]; int _roomnumber; ; virtual void Enter(); Room* OtherSideFrom(Room*); private: Room* _room1; Room* _room2; bool _isopen; ; class Maze { public: Maze(); Maze(const Maze&); Room* RoomNo(int); void AddRoom(Room*); virtual Maze* Clone() const; private: //... ; 19

20 패턴미적용사례 - 코드 Maze* MazeGame::CreateMaze() { Maze* amaze = new Maze; Room* r1 = new Room(1); Room* r2 = new Room(2); Door *thedoor = new Door(r1, r2); amaze->addroom(r1); amaze->addroom(r2); r1->setside(north, new Wall); r1->setside(east, thedoor); r1->setside(south, new Wall); r1->setside(west, new Wall); r2->setside(north, new Wall); r2->setside(east, new Wall); r2->setside(south, new Wall); r2->setside(west, thedoor); l MazeGame::CreateMaze() l Maze 생성 (amaze) l Room 을두개생성 (r1, r2) l Door 을하나생성 (thedoor) l amaze 에 r1, r2 추가 l r1 은동쪽에 thedoor 를연결하고나머지방향에는 Wall 을연결 l r2는서쪽에 thedoor를연결하고나머지방향에는 Wall 을연결 return amaze; 20

21 패턴미적용사례 - 문제점 l 문제점 : l 미로의구조가하드코딩되어있기때문에미로구조가변경될때마다코드 (MazeGame::CreateMaze()) 를수정하여야한다. l 기존의미로를다음의요소들이추가되는 마법의미로 로바꾸려한다. 주문을외면열리는문 (DoorNeedingSpell) 특별아이템이숨어있는방 (EnchantedRoom) à 어떤코드들이변경되어야하는가? à 쉽게변경할수있는가? 객체들의생성과그과정이하드코딩되어있기때문에변화에대처하기힘들다. Creational Patterns 을이용함으로써이러한문제점을해결할수있다. 21

22 팩토리패턴의개념 ( 정적모형 ) Client RequiredClass «create object» MyClass createobjectofrequiredclass(): RequiredClass Factory design pattern 22

23 팩토리패턴의개념 ( 동적모형 ) :Client :MyClass :RequiredClass createobjectofrequiredclass() RequiredClass() 23

24 팩토리패턴의간단한예제 Client Automobile createautomobile(): Automobile Application of Factory design pattern Hyundai createautomobile() Kia createautomobile() 24 «create object» class Hyundai extends Automobile {... Automobile createautomobile() { return new Hyundai();... «create object»

25 팩토리패턴의예 : 메일생성시스템 l 생성시스템 l 다양한고객에맞추어진메일메시지를생성하는시스템 25

26 사례 #3: 메일시스템 1. 메일생성시스템은고객의이메일주소를요청한다. 2. 사용자는고객의이메일주소를입력한다. 3. 메일생성시스템은고객타입의목록을보여주며, 어떤타입의고객메일메시지인지를묻는다. 4. 사용자는의도한고객타입을입력한다. 5. 메일생성시스템은고객의타입을모니터에다시출력해준다. 6. 메일생성시스템은모든고객에게보내지는부분과사용자에의해요구에맞춰진메일로구성된메일메시지를모니터에출력한다. 7. 메일생성시스템은메시지를보낸다. 26

27 이메일생성시스템 Application of Factory design pattern Customer getmessage() Frequent Returning Curious Newbie getmessage() getmessage() getmessage() getmessage() Client sendmessage() 27 «setup» MailGenerationApplication getcustomertypefromuser() MailMessage text

28 클라이언트클래스 class Client { public Client() { super(); public void sendmessage(customer acustomer) { MailMessage mailmessage = acustomer.getmessage(); System.out.println("This message will be sent:"); System.out.println(mailMessage.getText()); abstract class Customer { public MailMessage getmessage() { return new MailMessage( "Losts of material intended for all customers..." ); 28

29 애플리케이션 import java.io.*; import java.util.*; class MailGenerationApplication { private static Client client = new Client(); public MailGenerationApplication() { super(); public static void main(string[ ] args) { Customer customer = getcustomertypefromuser(); MailGenerationApplication.client.sendMessage(cu stomer); // let the client do its job private static Customer getcustomertypefromuser() { String customertype = "newbie"; // default Hashtable customertypetable = new Hashtable(); // keys strings to Customer types 29 customertypetable.put("frequent", new Frequent()); customertypetable.put("returning", new Returning()); customertypetable.put("curious", new Curious()); customertypetable.put("newbie", new Newbie()); System.out.println( "Please pick a type of customer from one of the following:"); for (Enumeration enumeration = customertypetable.keys(); enumeration.hasmoreelements(); ) { System.out.println(enumeration.nextElement()); try { // pick up user's input BufferedReader bufreader = new BufferedReader(new InputStreamReader(System.in)); customertype = bufreader.readline(); catch (IOException e) { System.out.println(e);

30 애플리케이션 Customer customerselected = (Customer) customertypetable.get(customertype); if (customerselected!= null) return customerselected; else { // use default if user input bad System.out.println("Sorry: Could not understand your input: newbie customer assumed."); return new Newbie(); // end getcustomertypefromuser() 30

31 팩토리패턴이적용된코드 class MailMessage { String text = "No text chosen yet"; public MailMessage() { super(); public MailMessage( String atext ) { this(); text = atext; public String gettext() { return text; public void settext( String astring ) { text = astring; class Frequent extends Customer { public Frequent() { super(); public MailMessage getmessage() { String frequentcustomermessage = "... a (possibly long) message for frequent customers..."; String messagetextforallcustomers = ( super.getmessage() ).gettext(); return new MailMessage( "\n" + messagetextforallcustomers + "\n" + frequentcustomermessage ); 31

32 팩토리패턴사례 : 미로게임 l Sample Code l Slide 7,8 에있는 Maze 소스코드의경우 미로의구성요소 (Room, Door, Wall) 생성이 hard-coding 되어있다. Maze* MazeGame::CreateMaze() { Maze* amaze = new Maze; Room* r1 = new Room(1); Room* r2 = new Room(2); Door *thedoor = new Door(r1, r2); return amaze; Factory Method pattern 을적용한다면? 32

33 팩토리패턴사례 : 미로게임 class MazeGame { public: Maze* CreateMaze(); override 될 factory method factory method 를이용하여객체생성 ; // factory methods: virtual Maze* MakeMaze() const { return new Maze; virtual Room* MakeRoom(int n) const { return new Room(n); virtual Wall* MakeWall() const { return new Wall; virtual Door* MakeDoor(Room* r1, Room* r2) const { return new Door(r1, r2); Maze* MazeGame::CreateMaze () { Maze* amaze = MakeMaze(); Room* r1 = MakeRoom(1); Room* r2 = MakeRoom(2); Door* thedoor = MakeDoor(r1, r2); amaze->addroom(r1); amaze->addroom(r2); r1->setside(north, MakeWall()); r1->setside(east, thedoor); r1->setside(south, MakeWall()); r1->setside(west, MakeWall()); r2->setside(north, MakeWall()); r2->setside(east, MakeWall()); r2->setside(south, MakeWall()); r2->setside(west, thedoor); return amaze; 33

34 팩토리패턴사례 : 미로게임 class BombedMazeGame : public MazeGame { public: BombedMazeGame(); virtual Wall* MakeWall() const { return new BombedWall; virtual Room* MakeRoom(int n) const { return new RoomWithABomb(n); ; factory method // Client Code BombedMazeGame game1; EnchantedMazeGame game2; class EnchantedMazeGame : public MazeGame { public: EnchantedMazeGame(); virtual Room* MakeRoom(int n) const { return new EnchantedRoom(n, CastSpell()); virtual Door* MakeDoor(Room* r1, Room* r2) const { return new DoorNeedingSpell(r1, r2); protected: Spell* CastSpell() const; ; game1.createmaze(); game2.createmaze(); 34

35 Pattern #2 싱글톤패턴 목적어떤클래스, S 의인스턴스를단하나만만들고싶을때. 어플리케이션전체에꼭하나만필요한경우. l 패턴의핵심 l S 의생성자를 private 으로만들고, S 안에 private 정적속성을정의한다. 이를접근하는 public 함수를제공한다. l 싱글톤은오직한개의객체만존재하려는목적이있어더이상만들려는생성자의호출을안전하게막아야한다. 35

36 싱글톤패턴 클래스다이어그램 Client Singleton Design Pattern MyClass getsingletonofmyclass(): MyClass singletonofmyclass «static» 1 36

37 싱글톤패턴 MyClass 1. MyClass 클래스안에 MyClass 라는이름의 private 정적변수를선언한다. l private static MyClass singletonofmyclass = new MyClass(); 2. MyClass 의생성자를 private 으로만든다. l private MyClass() { /*. constructor code. */ ; 3. 멤버를접근하는정적 public 메소드를정의한다. public static MyClass getsingletonofmyclass() { return singletonofmyclass; 37

38 사례 #1 보고서문제 l 연구실의실험결과평가어플리케이션 l 정확히하나의 experiment 객체만이실시간에존재함을보장하여야함 l 어플리케이션에서 experiment 를접근할때다음과같이표시 38

39 사례 #1 보고서문제 l 클래스다이어그램 Client Experiment theexperiment: Experiment analyze() gettheexperiment(): Experiment reportresults() 1 theexperiment «static» 39

40 사례 #1 코드 class Client { public Client() { super(); public static void main( String[] args ) { Experiment experiment = Experiment.getTheExperiment(); experiment.analyze(); experiment.reportresults(); class Experiment { private static final Experiment theexperiment = new Experiment(); String result = "Experiment result not yet assigned"; // result of the experiment private static int numtimesreferenced = 0; private Experiment() { super(); public synchronized void analyze() { theexperiment.result = "... The analysis shows that the experiment was a resounding success...."; 40

41 사례 #1 코드 public static Experiment gettheexperiment() { ++numtimesreferenced; System.out.println ("Noting that the Experiment singleton referenced " + numtimesreferenced + " times so far"); return theexperiment; public void reportresults() { System.out.println(result); 41

42 사례 #2 미로게임 l Sample Code l Abstract Factory pattern 의 Sample Code 에서 MazeFactory 부분을 Singleton 클래스로작성 그러나, MazeFactory::Instance() 함수에서실제생성되는 Factory 는환경변수 MAZESTYLE 에따라 MazeFactory, BombedMazeFactory, EnchantedMazeFactory 등이생성되도록구현한다. l 변경되는부분 MazeFactory Client Code 42

43 사례 #2 미로게임 class MazeFactory { public: static MazeFactory* Instance(); // existing interface goes here protected: MazeFactory(); private: static MazeFactory* _instance; ; // Client Code setenv( MAZESTYLE, bombed,1); MazeFactory *factory = MazeFactory::Instance(); MazeGame game; game.createmaze(factory); MazeFactory* MazeFactory::_instance = 0; MazeFactory* MazeFactory::Instance () { if (_instance == 0) { const char* mazestyle = getenv("mazestyle"); if (strcmp(mazestyle, "bombed") == 0) { _instance = new BombedMazeFactory; else if (strcmp(mazestyle, "enchanted") == 0) { _instance = new EnchantedMazeFactory; //... other possible subclasses else _instance = new MazeFactory; return _instance; 43 환경변수값에따라실제 factory 객체를결정

44 Pattern #3 - 프로토타입패턴 런타임에그타입이결정되는거의동일한객체의집합을만들려고할때적용. l 가정 l 프로토타입이될인스턴스를이미알고있어야함 l 새로운인스턴스가필요할때언제든지이를클론화 l 인스턴스를만드는방법 l New Something() l MyPart anothermypart = MyPartPrototype.clone(); 44

45 프로토타입패턴 : 동기 A 회사는자사의주력제품인 보고서관리 Class Library 의 upgrade 프로젝트를결정하였으며, 그개발팀의시스템설계자로당신이선발되었다. upgrade 는주로고객 (library 를이용하는개발자 ) 의불만사항을해결하는데초점이맞추어져있다. - 보고서관리 Class Library 의현재상황개발자는실제보고서객체 (ReportA, ReportB, ) 를직접다루지않고모두 Report 객체로간주하여이용한다. 즉, 실제보고서객체는외부에서접근하지못한다. [ 보고서관리 Class Library] Client Code ReportA Report ReportC 45 ReportB ReportD

46 프로토타입패턴 : 동기 l 고객 ( 개발자 ) 의불만사항 l 특정 Report 객체를넘겨받아이를이용하여작업을수행한다. l 그러나, 넘겨받은 Report 객체와동일한 Report 객체를생성해야되는경우엔어떻게해야되는가? l 예를들면현재 Client Code 에서특정 Report 객체 ( 실제로는 ReportA 객체라고가정 ) 를가지고작업중인데, 이보고서의복사본을생성하기위해서는어떻게해야하는가? (Client Code 는이객체가 ReportA 임을알수없다.) // Client Code CopyReport(Report *rep) { Report *rep2 = new??? What?? ReportA ReportB ReportC. 46

47 프로토타입패턴 : 동기 l 불만사항해결방안 1 47 // Client Code CopyReport(Report *rep) { Report *rep2; switch ( rep->gettype() ) { case REPORTA: rep2 = new ReportA; break; case REPORTB: rep2 = new ReportB; break; case REPORTC: rep3 = new ReportC; break; // use rep2. [ 문제점 ] 1. Client Code에게구체적 Report 객체로의접근을허용해야한다. 2. Client Code에서모든구체적 Report 객체를알고있어야한다. 3. 새로운구체적 Report 객체가추가될때마다 Client Code 가수정되어야한다. 4. rep2 객체가적합한클래스로생성은되지만, rep의내용을또다시복사해야한다.

48 프로토타입패턴 : 동기 l 불만사항해결방안 2: l 특정객체를복사해야되는경우, 객체생성과내용복사기능을해당객체에맡긴다. 48 // Client Code CopyReport(Report *rep) { Report *rep2 = rep->clone(); // use rep2 clone 함수는실제구체객체와동일한내용을가지는객체를생성해서반환하는기능제공 1. Client Code 에게구체적 Report 객체로의접근을허용하지않아도된다. 2. Client Code 에서모든구체적 Report 객체를알필요가없다. 3. 새로운구체적 Report 객체가추가되더라도기존 Client Code 가수정될필요는없다. 4. clone 함수내에서 rep 의내용의복사작업을수행한다. 48

49 프로토타입패턴 : 동기 [ 보고서관리 Class Library] Client Code Report clone() Report *rep2 = rep1->clone(); ReportA ReportC clone() clone() ReportB clone() ReportD clone() return new ReportB(this); return new ReportD(this); 49

50 프로토타입사례 Furniture color 50 Click on choice of desk: Click on choice of storage: Click on choice of chair: Furniture hardware type colonial

51 프로토타입사례 51

52 프로토타입패턴 Client (optional part of interface) Ensemble createensemble() Part1 clone() Part2 clone() MyPart anothermypart = mypartprototype.clone(); MyPart yetanothermypart = MyPartPrototype.clone(); 52

53 프로토타입패턴 The Prototype Idea Client Ensemble createensemble() mypartprototype 1 MyPart clone(): MyPart // To create a MyPart instance: MyPart p = mypartprototype.clone(); Prototype Design Pattern 53 MyPartStyleA clone() MyPartStyleB clone()

54 Client Ensemble createensemble() 프로토타입패턴 : 클래스모델 Part1 clone() part1prototype... // To create a Part1 object: Part1 p1 = part1prototype.clone();. 1 1 Part2 clone() part2prototype Part1StyleA clone() Part1StyleB clone() Part1StyleC clone() Part2StyleA clone() Part2StyleB clone() 54 Part1StyleB returnobject = new Part1StyleB();.

55 프로토타입패턴 : 동적다이어그램 :Ensemble partnprototype :PartN partnprototype :PartNStyleB :PartNStyleB createensemble() clone() PartNStyleB() (virtual function property) 55

56 프토토타입패턴사례 - 미로게임 l Sample Code l Abstract Factory pattern 의 Sample Code 에서 미로구축에사용되는 product 객체들 (room, wall, door) 을생성하기위하여, factory 를사용하였다. 다른 family 의 product 객체를생성하기위하여각 family 별로 factory 를작성하였다. (EnchantedMazeFactory, BombedMazeFactory) 만일 Factory 를하나만두고, 미리지정된 prototype 객체를이용하여 Room, Wall, Door 객체를생성하려면? 56 Factory 생성시각 product 객체의 prototype 객체를지정 각 product 객체에 Clone() 함수를구현하고, 필요시 Initialize() 함수를구현

57 class MazePrototypeFactory : public MazeFactory { public: MazePrototypeFactory(Maze*, Wall*, Room*, Door*) { _prototypemaze = m; _prototypewall = w; _prototyperoom = r; _prototypedoor = d; virtual Maze* MakeMaze() const { return _prototypemaze->clone(); virtual Room* MakeRoom(int roomno) const { Room *room = _prototyperoom->clone(); room->initialize(roomno); return room; virtual Wall* MakeWall() const { return _ptototypewall->clone(); virtual Door* MakeDoor(Room*, Room*) const { Door *door = _prototypedoor->clone(); door->initialize(r1,r2); return door; private: Maze* _prototypemaze; Room* _prototyperoom; Wall* _prototypewall; Door* _prototypedoor; ; 57 객체생성을위한 prototype 객체지정 - prototype 객체를이용하여 Maze, Room, Wall, Door 객체생성. - Room & Door 의경우 Initialize 함수를호출하여초기값지정 객체생성에사용될 prototype 객체

58 class Door : public MapSite { public: Door(); Door(const Door&){ _room1 = other._room1; _room2 = other._room2; virtual void Initialize(Room*, Room*){ _room1 = r1; _room2 = r2; virtual Door* Clone() const{ return new Door(*this); virtual void Enter(); Room* OtherSideFrom(Room*); private: Room* _room1; Room* _room2; ; class Wall : public MapSite { ; class Room: public MapSite { ; 58 clone() 후초기값설정함수 객체복제를위한 clone() 함수 // Client Code factory 에각객체생성을위한 prototype 객체지정 MazeGame game; MazePrototypeFactory simplemazefactory( new Maze, new Wall, new Room, new Door ); Maze* maze = game.createmaze(simplemazefactory);

59 프토토타입패턴사례 - 미로게임 class BombedWall : public Wall { public: BombedWall(); BombedWall(const BombedWall&): Wall(other) { _bomb = other._bomb; virtual Wall* Clone() const { return new BombedWall(*this); bool HasBomb() { return _bomb; private: bool _bomb; ; class RoomWithABomb : public MapSite { ; // Client Code MazeGame game; MazePrototypeFactory bombedmazefactory( new Maze, new BombedWall, new RoomWithABomb, new Door ); 59 Maze* maze = game.createmaze(bombedmazefactory);

60 Questions?

JAVA PROGRAMMING 실습 08.다형성

JAVA PROGRAMMING 실습 08.다형성 2015 학년도 2 학기 1. 추상메소드 선언은되어있으나코드구현되어있지않은메소드 abstract 키워드사용 메소드타입, 이름, 매개변수리스트만선언 public abstract String getname(); public abstract void setname(string s); 2. 추상클래스 abstract 키워드로선언한클래스 종류 추상메소드를포함하는클래스

More information

학습목표 l 추상팩토리패턴과그적용 l 빌더패턴과그적용 l 실습문제 2

학습목표 l 추상팩토리패턴과그적용 l 빌더패턴과그적용 l 실습문제 2 객체지향설계와패턴 Lecture #10: 생성패턴 (2) Eun Man Choi emchoi@dgu.ac.kr 학습목표 l 추상팩토리패턴과그적용 l 빌더패턴과그적용 l 실습문제 2 Pattern #4 추상팩토리패턴 구체적인클래스의명시없이관련객체의패밀리를 생성하기위한인터페이스를제공하기위하여사용 l 목적 l 결과 l 객체생성을추상화하여이를사용하는모듈과독립적으로인터페이스를정의하는데있다.

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 @ Lesson 2... ( ). ( ). @ vs. logic data method variable behavior attribute method field Flow (Type), ( ) member @ () : C program Method A ( ) Method B ( ) Method C () program : Java, C++, C# data @ Program

More information

PowerPoint Presentation

PowerPoint Presentation Class - Property Jo, Heeseung 목차 section 1 클래스의일반구조 section 2 클래스선언 section 3 객체의생성 section 4 멤버변수 4-1 객체변수 4-2 클래스변수 4-3 종단 (final) 변수 4-4 멤버변수접근방법 section 5 멤버변수접근한정자 5-1 public 5-2 private 5-3 한정자없음

More information

gnu-lee-oop-kor-lec06-3-chap7

gnu-lee-oop-kor-lec06-3-chap7 어서와 Java 는처음이지! 제 7 장상속 Super 키워드 상속과생성자 상속과다형성 서브클래스의객체가생성될때, 서브클래스의생성자만호출될까? 아니면수퍼클래스의생성자도호출되는가? class Base{ public Base(String msg) { System.out.println("Base() 생성자 "); ; class Derived extends Base

More information

q 이장에서다룰내용 1 객체지향프로그래밍의이해 2 객체지향언어 : 자바 2

q 이장에서다룰내용 1 객체지향프로그래밍의이해 2 객체지향언어 : 자바 2 객체지향프로그래밍 IT CookBook, 자바로배우는쉬운자료구조 q 이장에서다룰내용 1 객체지향프로그래밍의이해 2 객체지향언어 : 자바 2 q 객체지향프로그래밍의이해 v 프로그래밍기법의발달 A 군의사업발전 1 단계 구조적프로그래밍방식 3 q 객체지향프로그래밍의이해 A 군의사업발전 2 단계 객체지향프로그래밍방식 4 q 객체지향프로그래밍의이해 v 객체란무엇인가

More information

PowerPoint Presentation

PowerPoint Presentation 객체지향프로그래밍 인터페이스, 람다식, 패키지 ( 실습 ) 손시운 ssw5176@kangwon.ac.kr 예제 1. 홈네트워킹 public interface RemoteControl { public void turnon(); // 가전제품을켠다. public void turnoff(); // 가전제품을끈다. 인터페이스를구현 public class Television

More information

Microsoft PowerPoint - 04-UDP Programming.ppt

Microsoft PowerPoint - 04-UDP Programming.ppt Chapter 4. UDP Dongwon Jeong djeong@kunsan.ac.kr http://ist.kunsan.ac.kr/ Dept. of Informatics & Statistics 목차 UDP 1 1 UDP 개념 자바 UDP 프로그램작성 클라이언트와서버모두 DatagramSocket 클래스로생성 상호간통신은 DatagramPacket 클래스를이용하여

More information

PowerPoint Presentation

PowerPoint Presentation public class SumTest { public static void main(string a1[]) { int a, b, sum; a = Integer.parseInt(a1[0]); b = Integer.parseInt(a1[1]); sum = a + b ; // 두수를더하는부분입니다 System.out.println(" 두수의합은 " + sum +

More information

PowerPoint Presentation

PowerPoint Presentation public class SumTest { public static void main(string a1[]) { int a, b, sum; a = Integer.parseInt(a1[0]); b = Integer.parseInt(a1[1]); sum = a + b ; // 두수를더하는부분입니다 System.out.println(" 두수의합은 " + sum +

More information

<4D F736F F F696E74202D20C1A63038C0E520C5ACB7A1BDBABFCD20B0B4C3BC4928B0ADC0C729205BC8A3C8AF20B8F0B5E55D>

<4D F736F F F696E74202D20C1A63038C0E520C5ACB7A1BDBABFCD20B0B4C3BC4928B0ADC0C729205BC8A3C8AF20B8F0B5E55D> Power Java 제 8 장클래스와객체 I 이번장에서학습할내용 클래스와객체 객체의일생직접 메소드클래스를 필드작성해 UML 봅시다. QUIZ 1. 객체는 속성과 동작을가지고있다. 2. 자동차가객체라면클래스는 설계도이다. 먼저앞장에서학습한클래스와객체의개념을복습해봅시다. 클래스의구성 클래스 (class) 는객체의설계도라할수있다. 클래스는필드와메소드로이루어진다.

More information

PowerPoint Presentation

PowerPoint Presentation 객체지향프로그래밍 클래스, 객체, 메소드 ( 실습 ) 손시운 ssw5176@kangwon.ac.kr 예제 1. 필드만있는클래스 텔레비젼 2 예제 1. 필드만있는클래스 3 예제 2. 여러개의객체생성하기 4 5 예제 3. 메소드가추가된클래스 public class Television { int channel; // 채널번호 int volume; // 볼륨 boolean

More information

Design Issues

Design Issues 11 COMPUTER PROGRAMMING INHERIATANCE CONTENTS OVERVIEW OF INHERITANCE INHERITANCE OF MEMBER VARIABLE RESERVED WORD SUPER METHOD INHERITANCE and OVERRIDING INHERITANCE and CONSTRUCTOR 2 Overview of Inheritance

More information

05-class.key

05-class.key 5 : 2 (method) (public) (private) (interface) 5.1 (Method), (public method) (private method) (constructor), 3 4 5.2 (client). (receiver)., System.out.println("Hello"); (client object) (receiver object)

More information

PowerPoint Presentation

PowerPoint Presentation Package Class 1 Heeseung Jo 목차 section 1 패키지개요와패키지의사용 section 2 java.lang 패키지의개요 section 3 Object 클래스 section 4 포장 (Wrapper) 클래스 section 5 문자열의개요 section 6 String 클래스 section 7 StringBuffer 클래스 section

More information

12-file.key

12-file.key 11 (String).. java.lang.stringbuffer. s String s = "abcd"; s = s + "e"; a b c d e a b c d e ,., "910359,, " "910359" " " " " (token) (token),, (delimiter). java.util.stringtokenizer String s = "910359,,

More information

쉽게 풀어쓴 C 프로그래밍

쉽게 풀어쓴 C 프로그래밍 Power Java 제 11 장상속 이번장에서학습할내용 상속이란? 상속의사용 메소드재정의 접근지정자 상속과생성자 Object 클래스 종단클래스 상속을코드를재사용하기위한중요한기법입니다. 상속이란? 상속의개념은현실세계에도존재한다. 상속의장점 상속의장점 상속을통하여기존클래스의필드와메소드를재사용 기존클래스의일부변경도가능 상속을이용하게되면복잡한 GUI 프로그램을순식간에작성

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 인터페이스 배효철 th1g@nate.com 1 목차 인터페이스의역할 인터페이스선언 인터페이스구현 인터페이스사용 타입변환과다형성 인터페이스상속 디폴트메소드와인터페이스확장 2 인터페이스의역할 인터페이스란? 개발코드와객체가서로통신하는접점 개발코드는인터페이스의메소드만알고있으면 OK 인터페이스의역할 개발코드가객체에종속되지않게 -> 객체교체할수있도록하는역할 개발코드변경없이리턴값또는실행내용이다양해질수있음

More information

예제 2) Test.java class A intvar= 10; void method() class B extends A intvar= 20; 1"); void method() 2"); void method1() public class Test 3"); args) A

예제 2) Test.java class A intvar= 10; void method() class B extends A intvar= 20; 1); void method() 2); void method1() public class Test 3); args) A 제 10 장상속 예제 1) ConstructorTest.java class Parent public Parent() super - default"); public Parent(int i) this("hello"); super(int) constructor" + i); public Parent(char c) this(); super(char) constructor

More information

교육자료

교육자료 THE SYS4U DODUMENT Java Reflection & Introspection 2012.08.21 김진아사원 2012 SYS4U I&C All rights reserved. 목차 I. 개념 1. Reflection 이란? 2. Introspection 이란? 3. Reflection 과 Introspection 의차이점 II. 실제사용예 1. Instance의생성

More information

Microsoft PowerPoint - Supplement-03-TCP Programming.ppt [호환 모드]

Microsoft PowerPoint - Supplement-03-TCP Programming.ppt [호환 모드] - Socket Programming in Java - 목차 소켓소개 자바에서의 TCP 프로그램작성방법 주요클래스와메소드 HTTP 프로토콜을이용한예제 에코프로그램 Q/A 에코프로그램 - EchoServer 에코프로그램 - EchoClient TCP Programming 1 소켓소개 IP, Port, and Socket 포트 (Port): 전송계층에서통신을수행하는응용프로그램을찾기위한주소

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 @ Lesson 3 if, if else, if else if, switch case for, while, do while break, continue : System.in, args, JOptionPane for (,, ) @ vs. logic data method variable Data Data Flow (Type), ( ) @ Member field

More information

Microsoft PowerPoint - Lect04.pptx

Microsoft PowerPoint - Lect04.pptx OBJECT ORIENTED PROGRAMMING Object Oriented Programming 이강의록은 Power Java 저자의강의록을사용했거나재편집된것입니다. Class 와 object Class 와객체 클래스의일생 메소드 필드 String Object Class 와객체 3 클래스 클래스의구성 클래스 (l (class): 객체를만드는설계도 클래스로부터만들어지는각각의객체를특별히그클래스의인스턴스

More information

Microsoft PowerPoint - 03-TCP Programming.ppt

Microsoft PowerPoint - 03-TCP Programming.ppt Chapter 3. - Socket in Java - 목차 소켓소개 자바에서의 프로그램작성방법 주요클래스와메소드 HTTP 프로토콜을이용한예제 에코프로그램 에코프로그램 - EchoServer 에코프로그램 - EchoClient Q/A 1 1 소켓소개 IP,, and Socket 포트 (): 전송계층에서통신을수행하는응용프로그램을찾기위한주소 소켓 (Socket):

More information

Microsoft PowerPoint - java1-lab5-ImageProcessorTestOOP.pptx

Microsoft PowerPoint - java1-lab5-ImageProcessorTestOOP.pptx 2018 학년도 1 학기 JAVA 프로그래밍 II 514760-1 2018 년봄학기 5/10/2018 박경신 Lab#1 (ImageTest) Lab#1 은영상파일 (Image) 을읽어서정보를출력 Java Tutorials Lesson: Working with Images https://docs.oracle.com/javase/tutorial/2d/images/index.html

More information

2 단계 : 추상화 class 오리 { class 청둥오리 extends 오리 { class 물오리 extends 오리 { 청둥오리 mallardduck = new 청둥오리 (); 물오리 redheadduck = new 물오리 (); mallardduck.swim();

2 단계 : 추상화 class 오리 { class 청둥오리 extends 오리 { class 물오리 extends 오리 { 청둥오리 mallardduck = new 청둥오리 (); 물오리 redheadduck = new 물오리 (); mallardduck.swim(); 인터페이스적용 오리객체설계하기 ) 청둥오리, 물오리를설계하세요. 1 단계 : 필요한객체설계 class 청둥오리 { class 물오리 { 청둥오리 mallardduck = new 청둥오리 (); 물오리 redheadduck = new 물오리 (); mallardduck.swim(); mallardduck.fly(); mallardduck.quack(); redheadduck.swim();

More information

(8) getpi() 함수는정적함수이므로 main() 에서호출할수있다. (9) class Circle private double radius; static final double PI= ; // PI 이름으로 로초기화된정적상수 public

(8) getpi() 함수는정적함수이므로 main() 에서호출할수있다. (9) class Circle private double radius; static final double PI= ; // PI 이름으로 로초기화된정적상수 public Chapter 9 Lab 문제정답 1. public class Circle private double radius; static final double PI=3.141592; // PI 이름으로 3.141592 로초기화된정적상수 (1) public Circle(double r) radius = r; (2) public double getradius() return

More information

쉽게 풀어쓴 C 프로그래밍

쉽게 풀어쓴 C 프로그래밍 제 5 장생성자와접근제어 1. 객체지향기법을이해한다. 2. 클래스를작성할수있다. 3. 클래스에서객체를생성할수있다. 4. 생성자를이용하여객체를초기화할수 있다. 5. 접근자와설정자를사용할수있다. 이번장에서만들어볼프로그램 생성자 생성자 (constructor) 는초기화를담당하는함수 생성자가필요한이유 #include using namespace

More information

rmi_박준용_final.PDF

rmi_박준용_final.PDF (RMI) - JSTORM http://wwwjstormpekr (RMI)- Document title: Document file name: Revision number: Issued by: Document Information (RMI)- rmi finaldoc Issue Date: Status:

More information

Microsoft PowerPoint - 11_DesignPatterns(2010).ppt [호환 모드]

Microsoft PowerPoint - 11_DesignPatterns(2010).ppt [호환 모드] LECTURE 11 디자인패턴 최은만, CSE 4039 소프트웨어공학 설계작업에대한도전 소프트웨어설계는어려운일 문제를잘분할하고 유연하고잘모듈화된우아한디자인이되어야함 설계는시행착오 (trial and error) 의결과 성공적인설계가존재 두설계가똑같은일은없음 반복되는특성 최은만, CSE 4039 소프트웨어공학 2 디자인패턴 디자인패턴은공통된소프트웨어문제에오래동안사용되어검증된솔루션

More information

JAVA 프로그래밍실습 실습 1) 실습목표 - 메소드개념이해하기 - 매개변수이해하기 - 새메소드만들기 - Math 클래스의기존메소드이용하기 ( ) 문제 - 직사각형모양의땅이있다. 이땅의둘레, 면적과대각

JAVA 프로그래밍실습 실습 1) 실습목표 - 메소드개념이해하기 - 매개변수이해하기 - 새메소드만들기 - Math 클래스의기존메소드이용하기 (   ) 문제 - 직사각형모양의땅이있다. 이땅의둘레, 면적과대각 JAVA 프로그래밍실습 실습 1) 실습목표 - 메소드개념이해하기 - 매개변수이해하기 - 새메소드만들기 - Math 클래스의기존메소드이용하기 ( http://java.sun.com/javase/6/docs/api ) 문제 - 직사각형모양의땅이있다. 이땅의둘레, 면적과대각선의길이를계산하는메소드들을작성하라. 직사각형의가로와세로의길이는주어진다. 대각선의길이는 Math클래스의적절한메소드를이용하여구하라.

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 Lab 4 ADT Design 클래스로정의됨. 모든객체들은힙영역에할당됨. 캡슐화 (Encapsulation) : Data representation + Operation 정보은닉 (Information Hiding) : Opertion부분은가려져있고, 사용자가 operation으로만사용가능해야함. 클래스정의의형태 public class Person { private

More information

작성자 : 김성박\(삼성 SDS 멀티캠퍼스 전임강사\)

작성자 : 김성박\(삼성 SDS 멀티캠퍼스 전임강사\) Session 을이용한현재로그인한사용자의 숫자구하기 작성자 : 김성박 ( 삼성 SDS 멀티캠퍼스전임강사 ) email : urstory@nownuri.net homepage : http://sunny.sarang.net - 본문서는http://sunny.sarang.net JAVA강좌란 혹은 http://www.javastudy.co.kr 의 칼럼 란에서만배포합니다.

More information

자바 프로그래밍

자바 프로그래밍 5 (kkman@mail.sangji.ac.kr) (Class), (template) (Object) public, final, abstract [modifier] class ClassName { // // (, ) Class Circle { int radius, color ; int x, y ; float getarea() { return 3.14159

More information

JAVA PROGRAMMING 실습 02. 표준 입출력

JAVA PROGRAMMING 실습 02. 표준 입출력 # 왜생겼나요..? : 절차지향언어가가진단점을보완하고다음의목적을달성하기위해..! 1. 소프트웨어생산성향상 객체지향소프트웨어를새로만드는경우이미만든개체지향소프트웨어를상속받거나객체를 가져다재사용할수있어부분수정을통해소프트웨어를다시만드는부담줄임. 2. 실세계에대한쉬운모델링 실세계의일은절차나과정보다는일과관련된많은물체들의상호작용으로묘사. 캡슐화 메소드와데이터를클래스내에선언하고구현

More information

JAVA PROGRAMMING 실습 05. 객체의 활용

JAVA PROGRAMMING 실습 05. 객체의 활용 public class Person{ public String name; public int age; } public Person(){ } public Person(String s, int a){ name = s; age = a; } public String getname(){ return name; } @ 객체의선언 public static void main(string

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 실습 1 배효철 th1g@nate.com 1 목차 조건문 반복문 System.out 구구단 모양만들기 Up & Down 2 조건문 조건문의종류 If, switch If 문 조건식결과따라중괄호 { 블록을실행할지여부결정할때사용 조건식 true 또는 false값을산출할수있는연산식 boolean 변수 조건식이 true이면블록실행하고 false 이면블록실행하지않음 3

More information

Spring Boot/JDBC JdbcTemplate/CRUD 예제

Spring Boot/JDBC JdbcTemplate/CRUD 예제 Spring Boot/JDBC JdbcTemplate/CRUD 예제 오라클자바커뮤니티 (ojc.asia, ojcedu.com) Spring Boot, Gradle 과오픈소스인 MariaDB 를이용해서 EMP 테이블을만들고 JdbcTemplate, SimpleJdbcTemplate 을이용하여 CRUD 기능을구현해보자. 마리아 DB 설치는다음 URL 에서확인하자.

More information

쉽게 풀어쓴 C 프로그래밍

쉽게 풀어쓴 C 프로그래밍 Power Java 제 7 장클래스와객체 이번장에서학습할내용 객체지향이란? 객체 메시지 클래스 객체지향의장점 String 클래스 객체지향개념을완벽하게이해해야만객체지향설계의이점을활용할수있다. 실제세계는객체로이루어진다. 객체지향이란? 실제세계를모델링하여소프트웨어를개발하는방법 절차지향과객체지향 절차지향프로그래밍 (procedural programming): 문제를해결하는절차를중요하게생각하는방법

More information

PowerPoint Presentation

PowerPoint Presentation Package Class 3 Heeseung Jo 목차 section 1 패키지개요와패키지의사용 section 2 java.lang 패키지의개요 section 3 Object 클래스 section 4 포장 (Wrapper) 클래스 section 5 문자열의개요 section 6 String 클래스 section 7 StringBuffer 클래스 section

More information

Cluster management software

Cluster management software 자바네트워크프로그래밍 (OCJP 국제공인자격취득중심 ) 충북대학교 최민 기본예제 예외클래스를정의하고사용하는예제 class NewException extends Exception { public class ExceptionTest { static void methoda() throws NewException { System.out.println("NewException

More information

4장.문장

4장.문장 문장 1 배정문 혼합문 제어문 조건문반복문분기문 표준입출력 입출력 형식화된출력 [2/33] ANSI C 언어와유사 문장의종류 [3/33] 값을변수에저장하는데사용 형태 : < 변수 > = < 식 > ; remainder = dividend % divisor; i = j = k = 0; x *= y; 형변환 광역화 (widening) 형변환 : 컴파일러에의해자동적으로변환

More information

ThisJava ..

ThisJava .. 자바언어에정확한타입을추가한 ThisJava 소개 나현익, 류석영 프로그래밍언어연구실 KAIST 2014 년 1 월 14 일 나현익, 류석영 자바언어에정확한타입을추가한 ThisJava 소개 1/29 APLAS 2013 나현익, 류석영 자바 언어에 정확한 타입을 추가한 ThisJava 소개 2/29 실제로부딪힌문제 자바스크립트프로그램분석을위한요약도메인 나현익,

More information

슬라이드 1

슬라이드 1 UNIT 16 예외처리 로봇 SW 교육원 3 기 최상훈 학습목표 2 예외처리구문 try-catch-finally 문을사용핛수있다. 프로그램오류 3 프로그램오류의종류 컴파일에러 (compile-time error) : 컴파일실행시발생 럮타임에러 (runtime error) : 프로그램실행시발생 에러 (error) 프로그램코드에의해서해결될수없는심각핚오류 ex)

More information

Microsoft PowerPoint 장강의노트.ppt

Microsoft PowerPoint 장강의노트.ppt 클래스와객체 클래스와객체 객체 : 우리주변의어떤대상의모델 - 예 : 사람, 차, TV, 개 객체 = 상태 (state) + 행동 (behavior) - 예 : 개의상태 - 종자, 이름, 색개의행동 - 짖다, 가져오다 상태는변수로행동은메소드로나타냄 객체는클래스에의해정의된다. 클래스는객체가생성되는틀혹은청사진이다. 2 예 : 클래스와객체 질문 : 클래스와객체의다른예는?

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 @ Lesson 4 (Object) (Class) (Instance) (Method) (Constructor) Memory 1 UML 1 @ & 1 (Real World) (Software World) @ &.. () () @ & 2 (Real World) (Software World) OOA/ Modeling Abstraction Instantiation

More information

Microsoft PowerPoint - Java7.pptx

Microsoft PowerPoint - Java7.pptx HPC & OT Lab. 1 HPC & OT Lab. 2 실습 7 주차 Jin-Ho, Jang M.S. Hanyang Univ. HPC&OT Lab. jinhoyo@nate.com HPC & OT Lab. 3 Component Structure 객체 (object) 생성개념을이해한다. 외부클래스에대한접근방법을이해한다. 접근제어자 (public & private)

More information

* Factory class for query and DML clause creation * tiwe * */ public class JPAQueryFactory implements JPQLQueryFactory private f

* Factory class for query and DML clause creation * tiwe * */ public class JPAQueryFactory implements JPQLQueryFactory private f JPA 에서 QueryDSL 사용하기위해 JPAQuery 인스턴스생성방법 http://ojc.asia, http://ojcedu.com 1. JPAQuery 를직접생성하기 JPAQuery 인스턴스생성하기 QueryDSL의 JPAQuery API를사용하려면 JPAQuery 인스턴스를생성하면된다. // entitymanager는 JPA의 EntityManage

More information

설계란 무엇인가?

설계란 무엇인가? 금오공과대학교 C++ 프로그래밍 jhhwang@kumoh.ac.kr 컴퓨터공학과 황준하 9 강. 클래스의활용목차 멤버함수의외부정의 this 포인터 friend 선언 static 멤버 임시객체 1 /17 9 강. 클래스의활용멤버함수의외부정의 멤버함수정의구현방법 내부정의 : 클래스선언내에함수정의구현 외부정의 클래스선언 : 함수프로토타입 멤버함수정의 : 클래스선언외부에구현

More information

01-OOPConcepts(2).PDF

01-OOPConcepts(2).PDF Object-Oriented Programming Concepts Tel: 02-824-5768 E-mail: hhcho@selabsoongsilackr? OOP (Object) (Encapsulation) (Message) (Class) (Inheritance) (Polymorphism) (Abstract Class) (Interface) 2 1 + = (Dependency)

More information

(Microsoft PowerPoint - 11_DesignPatterns\(2008\).ppt [\310\243\310\257 \270\360\265\345])

(Microsoft PowerPoint - 11_DesignPatterns\(2008\).ppt [\310\243\310\257 \270\360\265\345]) LECTURE 11 디자인패턴 설계작업에대한도전 소프트웨어설계는어려운일 문제를잘분할하고 유연하고잘모듈화된우아한디자인이되어야함 설계는시행착오 (trial and error) 의결과 성공적인설계가존재 두설계가똑같은일은없음 반복되는특성 2 디자인패턴 디자인패턴은공통된소프트웨어문제에오래동안사용되어검증된솔루션 디자인작업에사용되는공통언어. 의사소통을향상시키며구현, 문서화에도움

More information

Microsoft PowerPoint - 2강

Microsoft PowerPoint - 2강 컴퓨터과학과 김희천교수 학습개요 Java 언어문법의기본사항, 자료형, 변수와상수선언및사용법, 각종연산자사용법, if/switch 등과같은제어문사용법등에대해설명한다. 또한 C++ 언어와선언 / 사용방법이다른 Java의배열선언및사용법에대해서설명한다. Java 언어의효과적인활용을위해서는기본문법을이해하는것이중요하다. 객체지향의기본개념에대해알아보고 Java에서어떻게객체지향적요소를적용하고있는지살펴본다.

More information

untitled

untitled - -, (insert) (delete) - - (insert) (delete) (top ) - - (insert) (rear) (delete) (front) A A B top A B C top push(a) push(b) push(c) A B top pop() top A B D push(d) top #define MAX_STACK_SIZE 100 int

More information

제11장 프로세스와 쓰레드

제11장 프로세스와 쓰레드 제9장자바쓰레드 9.1 Thread 기초 (1/5) 프로그램 명령어들의연속 (a sequence of instruction) 프로세스 / Thread 실행중인프로그램 (program in execution) 프로세스생성과실행을위한함수들 자바 Thread 2 9.1 Thread 기초 (2/5) 프로세스단위작업의문제점 프로세스생성시오버헤드 컨텍스트스위치오버헤드

More information

PowerPoint Presentation

PowerPoint Presentation Class : Method Jo, Heeseung 목차 section 1 생성자 (Constructor) section 2 생성자오버로딩 (Overloading) section 3 예약어 this section 4 메소드 4-1 접근한정자 4-2 클래스메소드 4-3 final, abstract, synchronized 메소드 4-4 메소드반환값 (return

More information

쉽게 풀어쓴 C 프로그래밍

쉽게 풀어쓴 C 프로그래밍 Power Java 제 9 장생성자와접근제어 이번장에서학습할내용 생성자 정적변수 정적메소드 접근제어 this 클래스간의관계 객체가생성될때초기화를담당하는생성자에대하여살펴봅니다. 생성자 생성자 (contructor): 객체가생성될때에필드에게초기값을제공하고필요한초기화절차를실행하는메소드 생성자의예 class Car { private String color; // 색상

More information

JAVA PROGRAMMING 실습 09. 예외처리

JAVA PROGRAMMING 실습 09. 예외처리 2015 학년도 2 학기 예외? 프로그램실행중에발생하는예기치않은사건 예외가발생하는경우 정수를 0으로나누는경우 배열의크기보다큰인덱스로배열의원소를접근하는경우 파일의마지막부분에서데이터를읽으려고하는경우 예외처리 프로그램에문제를발생시키지않고프로그램을실행할수있게적절한조치를취하는것 자바는예외처리기를이용하여예외처리를할수있는기법제공 자바는예외를객체로취급!! 나뉨수를입력하시오

More information

Java

Java Java http://cafedaumnet/pway Chapter 1 1 public static String format4(int targetnum){ String strnum = new String(IntegertoString(targetNum)); StringBuffer resultstr = new StringBuffer(); for(int i = strnumlength();

More information

Java ...

Java ... 컴퓨터언어 1 Java 제어문 조성일 조건문 : if, switch 어떠한조건을조사하여각기다른명령을실행 if 문, switch 문 if 문 if - else 문형식 if 문형식 if ( 조건식 ) { 명령문 1; 명령문 2;... if ( 조건식 ) { 명령문 1; 명령문 2;... else { 명령문 a; 명령문 b;... 예제 1 정수를입력받아짝수와홀수를판별하는프로그램을작성하시오.

More information

Spring Data JPA Many To Many 양방향 관계 예제

Spring Data JPA Many To Many 양방향 관계 예제 Spring Data JPA Many To Many 양방향관계예제 오라클자바커뮤니티 (ojc.asia, ojcedu.com) 엔티티매핑 (Entity Mapping) M : N 연관관계 사원 (Sawon), 취미 (Hobby) 는다 : 다관계이다. 사원은여러취미를가질수있고, 하나의취미역시여러사원에할당될수있기때문이다. 보통관계형 DB 에서는다 : 다관계는 1

More information

C++ Programming

C++ Programming C++ Programming 예외처리 Seo, Doo-okok clickseo@gmail.com http://www.clickseo.com 목 차 예외처리 2 예외처리 예외처리 C++ 의예외처리 예외클래스와객체 3 예외처리 예외를처리하지않는프로그램 int main() int a, b; cout > a >> b; cout

More information

10.0pt1height.7depth.3width±â10.0pt1height.7depth.3widthÃÊ10.0pt1height.7depth.3widthÅë10.0pt1height.7depth.3width°è10.0pt1height.7depth.3widthÇÁ10.0pt1height.7depth.3width·Î10.0pt1height.7depth.3width±×10.0pt1height.7depth.3width·¡10.0pt1height.7depth.3width¹Ö pt1height.7depth.3widthŬ10.0pt1height.7depth.3width·¡10.0pt1height.7depth.3width½º, 10.0pt1height.7depth.3width°´10.0pt1height.7depth.3widthü, 10.0pt1height.7depth.3widthº¯10.0pt1height.7depth.3width¼ö, 10.0pt1height.7depth.3width¸Þ10.0pt1height.7depth.3width¼Ò10.0pt1height.7depth.3widthµå

10.0pt1height.7depth.3width±â10.0pt1height.7depth.3widthÃÊ10.0pt1height.7depth.3widthÅë10.0pt1height.7depth.3width°è10.0pt1height.7depth.3widthÇÁ10.0pt1height.7depth.3width·Î10.0pt1height.7depth.3width±×10.0pt1height.7depth.3width·¡10.0pt1height.7depth.3width¹Ö pt1height.7depth.3widthŬ10.0pt1height.7depth.3width·¡10.0pt1height.7depth.3width½º, 10.0pt1height.7depth.3width°´10.0pt1height.7depth.3widthü, 10.0pt1height.7depth.3widthº¯10.0pt1height.7depth.3width¼ö, 10.0pt1height.7depth.3width¸Þ10.0pt1height.7depth.3width¼Ò10.0pt1height.7depth.3widthµå 기초통계프로그래밍 클래스, 객체, 변수, 메소드 hmkang@hallym.ac.kr 금융정보통계학과 강희모 ( 금융정보통계학과 ) 기초통계프로그래밍 1 / 26 자바구성파일 소스파일 소스파일 : 사용자가직접에디터에입력하는파일로자바프로그램언어가제공하는형식으로제작 소스파일의확장자는.java 임 컴파일 : javac 명령어를이용하여프로그래머가만든소스파일을컴파일하여실행파일.class

More information

Microsoft Word - java19-1-midterm-answer.doc

Microsoft Word - java19-1-midterm-answer.doc 중간고사 담당교수 : 단국대학교응용컴퓨터공학박경신 답은반드시답안지에기술할것. 공간이부족할경우반드시답안지몇쪽의뒤에있다고명기한후기술할것. 그외의경우의답안지뒤쪽이나연습지에기술한내용은답안으로인정안함. 답에는반드시네모를쳐서확실히표시할것. 답안지에학과, 학번, 이름외에본인의암호 (4자리숫자 ) 를기입하면성적공고시학번대신암호를 사용할것임. 1. 다음질문에답을하라. (55

More information

02 C h a p t e r Java

02 C h a p t e r Java 02 C h a p t e r Java Bioinformatics in J a va,, 2 1,,,, C++, Python, (Java),,, (http://wwwbiojavaorg),, 13, 3D GUI,,, (Java programming language) (Sun Microsystems) 1995 1990 (green project) TV 22 CHAPTER

More information

Microsoft PowerPoint - RMI.ppt

Microsoft PowerPoint - RMI.ppt ( 분산통신실습 ) RMI RMI 익히기 1. 분산환경에서동작하는 message-passing을이용한 boundedbuffer 해법프로그램을실행해보세요. 소스코드 : ftp://211.119.245.153 -> os -> OSJavaSources -> ch15 -> rmi http://marvel el.incheon.ac.kr의 Information Unix

More information

class Sale void makelineitem(productspecification* spec, int qty) SalesLineItem* sl = new SalesLineItem(spec, qty); ; 2. 아래의액티비티다이어그램을보고 Java 또는 C ++,

class Sale void makelineitem(productspecification* spec, int qty) SalesLineItem* sl = new SalesLineItem(spec, qty); ; 2. 아래의액티비티다이어그램을보고 Java 또는 C ++, Level 1은객관식사지선다형으로출제예정 1. 다음은 POST(Post of Sales Terminal) 시스템의한콜레보레이션다이어그램이다. POST 객체의 enteritem(upc, qty) 와 Sale 객체의 makellineitem(spec,qty) 를 Java 또는 C ++, C # 언어로구현하시오. 각메소드구현과관련하여각객체내에필요한선언이있으면선언하시오.

More information

No Slide Title

No Slide Title Copyright, 2001 Multimedia Lab., CH 3. COM object (In-process server) Eun-sung Lee twoss@mmlab.net Multimedia Lab. Dept. of Electrical and Computer Eng. University of Seoul Seoul, Korea 0. Contents 1.

More information

Network Programming

Network Programming Part 5 확장된 Network Programming 기술 1. Remote Procedure Call 2. Remote Method Invocation 3. Object Request Broker 2. Java RMI

More information

(Microsoft PowerPoint - java1-lecture11.ppt [\310\243\310\257 \270\360\265\345])

(Microsoft PowerPoint - java1-lecture11.ppt [\310\243\310\257 \270\360\265\345]) 예외와예외클래스 예외처리 514760-1 2016 년가을학기 12/08/2016 박경신 오류의종류 에러 (Error) 하드웨어의잘못된동작또는고장으로인한오류 에러가발생되면 JVM실행에문제가있으므로프로그램종료 정상실행상태로돌아갈수없음 예외 (Exception) 사용자의잘못된조작또는개발자의잘못된코딩으로인한오류 예외가발생되면프로그램종료 예외처리 추가하면정상실행상태로돌아갈수있음

More information

쉽게 풀어쓴 C 프로그래밊

쉽게 풀어쓴 C 프로그래밊 Power Java 제 27 장데이터베이스 프로그래밍 이번장에서학습할내용 자바와데이터베이스 데이터베이스의기초 SQL JDBC 를이용한프로그래밍 변경가능한결과집합 자바를통하여데이터베이스를사용하는방법을학습합니다. 자바와데이터베이스 JDBC(Java Database Connectivity) 는자바 API 의하나로서데이터베이스에연결하여서데이터베이스안의데이터에대하여검색하고데이터를변경할수있게한다.

More information

chap10.PDF

chap10.PDF 10 C++ Hello!! C C C++ C++ C++ 2 C++ 1980 Bell Bjarne Stroustrup C++ C C++ C, C++ C C 3 C C++ (prototype) (type checking) C C++ : C++ 4 C C++ (prototype) (type checking) [ 10-1] #include extern

More information

C# Programming Guide - Types

C# Programming Guide - Types C# Programming Guide - Types 최도경 lifeisforu@wemade.com 이문서는 MSDN 의 Types 를요약하고보충한것입니다. http://msdn.microsoft.com/enus/library/ms173104(v=vs.100).aspx Types, Variables, and Values C# 은 type 에민감한언어이다. 모든

More information

5장.key

5장.key JAVA Programming 1 (inheritance) 2!,!! 4 3 4!!!! 5 public class Person {... public class Student extends Person { // Person Student... public class StudentWorker extends Student { // Student StudentWorker...!

More information

mytalk

mytalk 한국정보보호학회소프트웨어보안연구회 총괄책임자 취약점분석팀 안준선 ( 항공대 ) 도경구 ( 한양대 ) 도구개발팀도경구 ( 한양대 ) 시큐어코딩팀 오세만 ( 동국대 ) 전체적인 그림 IL Rules Flowgraph Generator Flowgraph Analyzer 흐름그래프 생성기 흐름그래프 분석기 O parser 중간언어 O 파서 RDL

More information

Microsoft PowerPoint 자바-기본문법(Ch2).pptx

Microsoft PowerPoint 자바-기본문법(Ch2).pptx 자바기본문법 1. 기본사항 2. 자료형 3. 변수와상수 4. 연산자 1 주석 (Comments) 이해를돕기위한설명문 종류 // /* */ /** */ 활용예 javadoc HelloApplication.java 2 주석 (Comments) /* File name: HelloApplication.java Created by: Jung Created on: March

More information

PowerPoint Presentation

PowerPoint Presentation 객체지향프로그래밍 클래스, 객체, 메소드 손시운 ssw5176@kangwon.ac.kr 실제세계는객체로이루어진다. 2 객체와메시지 3 객체지향이란? 실제세계를모델링하여소프트웨어를개발하는방법 4 객체 5 객체란? 객체 (Object) 는상태와동작을가지고있다. 객체의상태 (state) 는객체의특징값 ( 속성 ) 이다. 객체의동작 (behavior) 또는행동은객체가취할수있는동작

More information

JAVA PROGRAMMING 실습 07. 상속

JAVA PROGRAMMING 실습 07. 상속 상속 부모클래스에정의된필드와메소드를자식클래스가물려받는것 슈퍼클래스 (superclass) 특성을물려주는상위클래스 서브클래스 (subclass) 특성을물려받는하위클래스 슈퍼클래스에자신만의특성 ( 필드, 메소드 ) 추가 슈퍼클래스의특성 ( 메소드 ) 을수정 = 오버라이딩구체화 class Phone 전화걸기전화받기 class MobilePhone 전화걸기전화받기무선기지국연결배터리충전하기

More information

K&R2 Reference Manual 번역본

K&R2 Reference Manual 번역본 typewriter structunion struct union if-else if if else if if else if if if if else else ; auto register static extern typedef void char short int long float double signed unsigned const volatile { } struct

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 @ Lesson 1,..... @ 1 Green Project 1991 Oak Java 1995. 5 December '90 by Patrick Naughton, Mike Sheridan and James Gosling Embedded in various consumer electronic device 1992. 9. 3 Star 7 1993 www portability

More information

Mobile Service > IAP > Android SDK [ ] IAP SDK TOAST SDK. IAP SDK. Android Studio IDE Android SDK Version (API Level 10). Name Reference V

Mobile Service > IAP > Android SDK [ ] IAP SDK TOAST SDK. IAP SDK. Android Studio IDE Android SDK Version (API Level 10). Name Reference V Mobile Service > IAP > Android SDK IAP SDK TOAST SDK. IAP SDK. Android Studio IDE 2.3.3 Android SDK Version 2.3.3 (API Level 10). Name Reference Version License okhttp http://square.github.io/okhttp/ 1.5.4

More information

신림프로그래머_클린코드.key

신림프로그래머_클린코드.key CLEAN CODE 6 11st Front Dev. Team 6 1. 2. 3. checked exception 4. 5. 6. 11 : 2 4 : java (50%), javascript (35%), SQL/PL-SQL (15%) : Spring, ibatis, Oracle, jquery ? , (, ) ( ) 클린코드를 무시한다면 . 6 1. ,,,!

More information

PowerPoint Presentation

PowerPoint Presentation 객체지향프로그래밍 오류처리 손시운 ssw5176@kangwon.ac.kr 오류메시지를분석한다. 오류메시지에서많은내용을알수있다. 2 디버깅 디버거를사용하면프로그램에서쉽게오류를감지하고진단할수있다. 디버거는중단점을설정하여서프로그램의실행을제어할수있으며문장 단위로실행하거나변수의값을살펴볼수있다. 3 이클립스에서디버깅 4 이클립스에서디버깅 5 이클립스의디버깅명령어 6 예외처리

More information

슬라이드 1

슬라이드 1 -Part3- 제 4 장동적메모리할당과가변인 자 학습목차 4.1 동적메모리할당 4.1 동적메모리할당 4.1 동적메모리할당 배울내용 1 프로세스의메모리공간 2 동적메모리할당의필요성 4.1 동적메모리할당 (1/6) 프로세스의메모리구조 코드영역 : 프로그램실행코드, 함수들이저장되는영역 스택영역 : 매개변수, 지역변수, 중괄호 ( 블록 ) 내부에정의된변수들이저장되는영역

More information

Connection 8 22 UniSQLConnection / / 9 3 UniSQL OID SET

Connection 8 22 UniSQLConnection / / 9 3 UniSQL OID SET 135-080 679-4 13 02-3430-1200 1 2 11 2 12 2 2 8 21 Connection 8 22 UniSQLConnection 8 23 8 24 / / 9 3 UniSQL 11 31 OID 11 311 11 312 14 313 16 314 17 32 SET 19 321 20 322 23 323 24 33 GLO 26 331 GLO 26

More information

Chap12

Chap12 12 12Java RMI 121 RMI 2 121 RMI 3 - RMI, CORBA 121 RMI RMI RMI (remote object) 4 - ( ) UnicastRemoteObject, 121 RMI 5 class A - class B - ( ) class A a() class Bb() 121 RMI 6 RMI / 121 RMI RMI 1 2 ( 7)

More information

fundamentalOfCommandPattern_calmglow_pattern_jstorm_1.0_f…

fundamentalOfCommandPattern_calmglow_pattern_jstorm_1.0_f… Command JSTORM http://www.jstorm.pe.kr Command Issued by: < > Revision: Document Information Document title: Command Document file name: Revision number: Issued by: Issue

More information

<4D F736F F F696E74202D2036C0CFC2B05FB0B4C3BCC1F6C7E2C7C1B7CEB1D7B7A1B9D62E707074>

<4D F736F F F696E74202D2036C0CFC2B05FB0B4C3BCC1F6C7E2C7C1B7CEB1D7B7A1B9D62E707074> 객체지향프로그램밍 (Object-Oriented Programming) 1 C++ popular C 객체지향 (object oriented) C++ C : 상위계층언어특징 + 어셈블리언어특징 C++ : 소프트웨어개발플랫폼에객체지향개념제공 객체지향 : 자료와이들자료를어떻게다룰것인지따로생각하지않고단지하나의사물로생각 형 변수가사용하는메모리크기 변수가가질수있는정보

More information

Microsoft PowerPoint - 14주차 강의자료

Microsoft PowerPoint - 14주차 강의자료 Java 로만드는 Monster 잡기게임예제이해 2014. 12. 2 게임화면및게임방법 기사초기위치 : (0,0) 아이템 10 개랜덤생성 몬스터 10 놈랜덤생성 Frame 하단에기사위치와기사파워출력방향키로기사이동아이템과몬스터는고정종료버튼클릭하면종료 Project 구성 GameMain.java GUI 환경설정, Main Method 게임객체램덤위치에생성 Event

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 상속 배효철 th1g@nate.com 1 목차 상속개념 클래스상속 부모생성자호출 메소드재정의 final 클래스와 final 메소드 protected 접근제한자 타입변환과다형성 추상클래스 2 상속개념 상속 (Inheritance) 이란? 현실세계 : 부모가자식에게물려주는행위 부모가자식을선택해서물려줌 객체지향프로그램 : 자식 ( 하위, 파생 ) 클래스가부모 (

More information

<4D F736F F F696E74202D20C1A63235C0E520B3D7C6AEBFF6C5A920C7C1B7CEB1D7B7A1B9D628B0ADC0C729205BC8A3C8AF20B8F0B5E55D>

<4D F736F F F696E74202D20C1A63235C0E520B3D7C6AEBFF6C5A920C7C1B7CEB1D7B7A1B9D628B0ADC0C729205BC8A3C8AF20B8F0B5E55D> Power Java 제 25 장네트워크프로그래밍 이번장에서학습할내용 네트워크프로그래밍의개요 URL 클래스 TCP를이용한통신 TCP를이용한서버제작 TCP를이용한클라이언트제작 UDP 를이용한통신 자바를이용하여서 TCP/IP 통신을이용하는응응프로그램을작성하여봅시다. 서버와클라이언트 서버 (Server): 사용자들에게서비스를제공하는컴퓨터 클라이언트 (Client):

More information

Microsoft PowerPoint - C++ 5 .pptx

Microsoft PowerPoint - C++ 5 .pptx C++ 언어프로그래밍 한밭대학교전자. 제어공학과이승호교수 연산자중복 (operator overloading) 이란? 2 1. 연산자중복이란? 1) 기존에미리정의되어있는연산자 (+, -, /, * 등 ) 들을프로그래머의의도에맞도록새롭게정의하여사용할수있도록지원하는기능 2) 연산자를특정한기능을수행하도록재정의하여사용하면여러가지이점을가질수있음 3) 하나의기능이프로그래머의의도에따라바뀌어동작하는다형성

More information

소프트웨어공학개론 강의 5: 객체지향개념 최은만동국대학교컴퓨터공학과

소프트웨어공학개론 강의 5: 객체지향개념 최은만동국대학교컴퓨터공학과 소프트웨어공학개론 강의 5: 객체지향개념 최은만동국대학교컴퓨터공학과 왜객체지향인가? l 절차적패러다임 vs. 객체지향패러다임 l 뭐가다르지? 2 C 언어 l 프로그램은데이터와함수로구성 l 함수는데이터를조작 l 프로그램을조직화하기위해 l 기능적분할 l 자료흐름도 l 모듈 Main program global data call call call return return

More information

MVVM 패턴의 이해

MVVM 패턴의 이해 Seo Hero 요약 joshua227.tistory. 2014 년 5 월 13 일 이문서는 WPF 어플리케이션개발에필요한 MVVM 패턴에대한내용을담고있다. 1. Model-View-ViewModel 1.1 기본개념 MVVM 모델은 MVC(Model-View-Contorl) 패턴에서출발했다. MVC 패턴은전체 project 를 model, view 로나누어

More information

JVM 메모리구조

JVM 메모리구조 조명이정도면괜찮조! 주제 JVM 메모리구조 설미라자료조사, 자료작성, PPT 작성, 보고서작성. 발표. 조장. 최지성자료조사, 자료작성, PPT 작성, 보고서작성. 발표. 조원 이용열자료조사, 자료작성, PPT 작성, 보고서작성. 이윤경 자료조사, 자료작성, PPT작성, 보고서작성. 이수은 자료조사, 자료작성, PPT작성, 보고서작성. 발표일 2013. 05.

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 예외처리 배효철 th1g@nate.com 1 목차 예외와예외클래스 실행예외 예외처리코드 예외종류에따른처리코드 자동리소스닫기 예외처리떠넘기기 사용자정의예외와예외발생 예외와예외클래스 구문오류 예외와예외클래스 구문오류가없는데실행시오류가발생하는경우 예외와예외클래스 import java.util.scanner; public class ExceptionExample1

More information

목차 INDEX JSON? - JSON 개요 - JSONObject - JSONArray 서울시공공데이터 API 살펴보기 - 요청인자살펴보기 - Result Code - 출력값 HttpClient - HttpHelper 클래스작성 - JSONParser 클래스작성 공공

목차 INDEX JSON? - JSON 개요 - JSONObject - JSONArray 서울시공공데이터 API 살펴보기 - 요청인자살펴보기 - Result Code - 출력값 HttpClient - HttpHelper 클래스작성 - JSONParser 클래스작성 공공 메신저의새로운혁신 채팅로봇 챗봇 (Chatbot) 입문하기 소 이 메 속 : 시엠아이코리아 름 : 임채문 일 : soulgx@naver.com 1 목차 INDEX JSON? - JSON 개요 - JSONObject - JSONArray 서울시공공데이터 API 살펴보기 - 요청인자살펴보기 - Result Code - 출력값 HttpClient - HttpHelper

More information

PowerPoint Presentation

PowerPoint Presentation 자바프로그래밍 1 클래스와메소드심층연구 ( 실습 ) 손시운 ssw5176@kangwon.ac.kr 예제 1. 접근제어 class A { private int a; int b; public int c; // 전용 // 디폴트 // 공용 public class Test { public static void main(string args[]) { A obj = new

More information

1. 객체의생성과대입 int 형변수 : 선언과동시에초기화하는방법 (C++) int a = 3; int a(3); // 기본타입역시클래스와같이처리가능 객체의생성 ( 복습 ) class CPoint private : int x, y; public : CPoint(int a

1. 객체의생성과대입 int 형변수 : 선언과동시에초기화하는방법 (C++) int a = 3; int a(3); // 기본타입역시클래스와같이처리가능 객체의생성 ( 복습 ) class CPoint private : int x, y; public : CPoint(int a 6 장복사생성자 객체의생성과대입객체의값에의한전달복사생성자디폴트복사생성자복사생성자의재정의객체의값에의한반환임시객체 C++ 프로그래밍입문 1. 객체의생성과대입 int 형변수 : 선언과동시에초기화하는방법 (C++) int a = 3; int a(3); // 기본타입역시클래스와같이처리가능 객체의생성 ( 복습 ) class CPoint private : int x, y;

More information

임베디드시스템설계강의자료 6 system call 2/2 (2014 년도 1 학기 ) 김영진 아주대학교전자공학과

임베디드시스템설계강의자료 6 system call 2/2 (2014 년도 1 학기 ) 김영진 아주대학교전자공학과 임베디드시스템설계강의자료 6 system call 2/2 (2014 년도 1 학기 ) 김영진 아주대학교전자공학과 System call table and linkage v Ref. http://www.ibm.com/developerworks/linux/library/l-system-calls/ - 2 - Young-Jin Kim SYSCALL_DEFINE 함수

More information

09-interface.key

09-interface.key 9 Database insert(record r): boolean find(key k): Record 1 Record getkey(): Key * Record Key Database.? Key equals(key y): boolean Database insert(record r): boolean find(key k): Record * Database OK 1

More information