Microsoft PowerPoint - hci2-lecture6 [호환 모드]

Size: px
Start display at page:

Download "Microsoft PowerPoint - hci2-lecture6 [호환 모드]"

Transcription

1 Overview 상속성 & 참조형 년가을학기 9/26/2012 박경신 상속개념이해및파생클래스작성 Has-a Model 메소드재정의이해 추상클래스와봉인클래스의이해 인터페이스기능이해 형변환이해 값형과참조형의비교 Inheritance 상속 (Inheritance) 란상위클래스의기능과속성을하위클래스에게그대로물려주는것을의미 상위클래스를부모 / 기반클래스 (base Class), 하위클래스를자식 / 파생클래스 (derived Class) 라고정의 하위클래스 (derived Class) 는상속을받으면상위클래스 (base Class) 의모든멤버필드와메소드를사용할수있음 클래스의계층구조생성 - 상속받은 interface 사용보장 (upcasting) 재사용성및확장성 - 이미존재하는클래스를구체화하여새로운클래스생성 Inheritance 상속 (Inheritance) 정의 base 연산자로상위객체접근 클래스를정의할때 : ( 콜론 ) 을사용하여상속관계표시 class <derivedclass> dcl : <baseclass> class Shape class Circle: Shape

2 Motivation Repeated code! class Student string name; int age; public int GetAge() return age; int id; class Staff string name; int age; public int GetAge() return age; double salary; Inheritance Syntax 상속문법 상위클래스에공통멤버를정의 하위클래스에필요한멤버를추가 class Person string name; int age; public int GetAge() return age; class Student : Person int id; class Staff : Person double salary; Person 에는공통부분을정의 Student 에만있는멤버를추가 Employee 에만있는멤버를추가 Memory Allocation 상속시메모리할당 하위객체생성시상위객체도생성되어데이터의메모리할당 Base fields Derived field class Person string name; int age; class Student : Person int id; Student s = new Student(); s name age id Private Class Private 클래스 기반클래스가 private 클래스로접근지정이되어있는경우파생클래스를만들수없음 private class Person bli l S d P // 오류발생 public class Student : Person // 오류발생

3 Member Access 기반클래스멤버접근 기반클래스의 protected 와 public 으로지정된멤버만을상속 상속받은멤버는기반클래스에서접근지정자를유지 class Person protected string name; protected int GetAge() return age; class Student : Person int id; public int GetID() return id; static void Main () Student s = new Student(); int age = sgetage(); s.getage(); // 상속된객체에서기반객체의메소드호출 int id = s.getid(); // 상속된객체자신의메소드호출 // 상속된객체에서기반객체의 protected 멤버필드호출 Console.WriteLine( 학생이름 :0, s.name); Member Access 기반클래스의생성자호출 파생클래스에는기반클래스의생성자가상속되지않으므로직접호출해주어야함 파생클래스생성자 : base() 만약위의문법과같이명시적으로호출하지않으면암시적으로기반클래스의기본생성자를호출 public class Car public Car() // protected/public가아니며파생클래스에서 error public Car(int wheel) this.wheel = wheel; public class Sedan : Car Sedan() // Sedan() : base() 와동일 ( 암시적기반클래스생성자호출 ) Sedan(int wheel) : base(wheel) // 명시적으로기반클래스생성자호출 base 키워드 base 키워드 기반클래스의멤버를나타냄 상위클래스의멤버를하위클래스에서재정의 (override) 하였을경우디폴트는 override 된멤버 상위클래스의멤버를사용할경우명시 public class Car protected bool gasoline; protected Car() gasoline = true; protected Car(int wheel) this.wheel = wheel; gasoline = false; public class Sedan : Car private bool gasoline; Sedan() gasoline = false; // base.gasoline=true, this.gasoline= false Sedan(int wheel) : base(wheel) gasoline = true; public void SedanMove() if (base.gasoline) if(this.gasoline) Constructor Initializer base(argument-listopt) 는상속받은상위클래스의생성자호출 this(argument-listopt) 는자기자신에서정의한다른생성자호출 using System; class A public A() Console.WriteLine("A"); i class B : A public B() Console.WriteLine( WriteLine("B"); B); // B() : base() 와동일 public B(int foo) : this() // B() 호출하고난후에아래명령문호출 Console.WriteLine("B(0), foo); A class DefaultInitializerTest public static void Main() A A a1 = new A(); B B b1 = new B(); B b2 = new B(100); A B B(100)

4 using System; class C public int value; public C() : this(100) // C(foo) 를호출한후에아래명령문호출 Console.WriteLine( C"); public C(int foo) value = foo; Console.WriteLine( C = 0", value); class D : C public D() // 상위클래스의기본생성자를암시적으로호출 Console.WriteLine( WriteLine( D"); D); public D(int foo) : base(foo) // 상위클래스의생성자를명시적호출 Console.WriteLine( D = 0", foo); C = 100 C class DerivedInitializerTest public static void Main() C c1 = new C(); D d1 = new D(); D d2 = new D(42); C = 100 C D C = 42 D = 42 Has-a a Model 상속의기본적인관계 is-a 관계는강한연결이며 ~ 이다 라는의미 has-a 관계는 가지고있다 라는의미, 포함 위임관계 Car 클래스는라디오를갖고있고, 라디오를키고끄는경우, 기존의 has-a 관계를이용 ( 즉, Car 클래스는라디오를포함 ) 라디오를작동하는세부방법은각객체에위임 class Radio public void TurnOn(bool on) if (on) Console.WriteLine( radio on ); else Console.WriteLine( WriteLine( radioradio off ); ublic class Car private Radio music; public Car() music = new Radio(); // Car has-a Radio public void MusicOn(bool on) music.turnon(on); // 자식객체 (Radio) 의기능을부모객체 (Car) 에위임 // Has-a a Model 포함 / 위임관계 (has-a 관계 ) Car 클래스는에어콘과라디오클래스를갖고있음 Driver 클래스는차를구입해서온도를조절, 라디오작동 Car 클래스의객체를생성하면에어콘과라디오객체자동생성 Car 클래스는자식객체의기능은잘모르므로실제구현은위임 class cassairconditioner o public void Up() temperature++; public void Down() temperature--; public class Car private Airconditioner aircon; public Car() aircon = new Airconditioner(); // Car has-a Aircon public void TemperatureUp() aircon.up(); public void TemperatureDown() aircon.down(); // Has-a a Model public class CarHasATest public static Main() // 차를생성할때동시에라디오와에어컨생성 Car c = new Car( Avante ); // 라디오를켠다 c.musicon(true); // 에어컨온도를높인다 c.temperatureup();

5 Polymorphism 상위클래스에서선언된메소드를하위클래스에서재구현 (Override) 실행시간에새로정의된 Override된멤버의내용으로처리 (Late binding) Object Shape void Draw() Circle Rectangle void Draw() void Draw() Virtual Method Virtual 메소드 하위클래스에서재정의가가능하도록메소드를정의 static, private 과함께사용할수없음 Virtual 메소드정의 class Shape public string Name( ) public virtual void Draw( ) Method Overriding 상속된가상메소드 (virtual method) 를구현 ( 재정의 ) 하기위하여 override 키워드사용 virtual method와 override method는이름, 접근제한자, 반환값, 매개변수리스트가동일해야함 static, private을 override 와함께사용할수없음 class Shape public string Name( ) public virtual void Draw( ) class Circle: Shape public override string Name( ) // error public override void oidda Draw( () // virtual method 에대한재정의 // polymorphism public class Shape public virtual void Draw() Console.WriteLine("Shape Draw"); public class Circle : Shape public override void Draw() Console.WriteLine("Circle Draw"); public class Rectangle : Shape public override void Draw() Console.WriteLine("Rectangle Draw"); public class PolymorphismTest public static void Main() Shape s = new Shape(); s.draw(); // Shape Draw s = new Circle(); s.draw(); // Circle Draw s = new Rectangle(); sdraw(); s.draw(); // Rectangle Draw

6 class Employee public string name; protected int age, hoursworked; public Employee(string name, int age, int hoursworked) this.name = name; this.age = age; this.hoursworked hoursworked = hoursworked; public virtual double CalculatePay() // virtual method return (20000 * hoursworked); class SalariedEmployee : Employee protected int basepay; public SalariedEmployee(string name, int age, int hoursworked) : base(name, age, hoursworked) basepay = ; public override double CalculatePay() //method overriding return (basepay * hoursworked); // pay calculate 성명 : 아무개, 급여 : public class InheritanceTest 성명 : 일꾼, 급여 : public static void Main() Employee[] emplist = new Employee( 아무개 ", 22, 30), new SalariedEmployee( 일꾼 ", 22, 30) ; foreach (Employee e in emplist) Console.WriteLine(">> 성명 :0, 급여 :1", e.name, e.calculatepay()); l Abstract Classes 추상클래스 개체들의표준을추상화한클래스 상속관계에서가장상위에존재 abstract 키워드를사용하여정의 abstract class Shape public abstract void Draw(); public class Circle : Shape public override void Draw() public class Square : Shape public override void Draw() 추상클래스는객체를 생성할수없음 class AbstractTest static void Main( ) //Shape s = new Shape( ); // error s = new Circle(); s.draw(); // circle draw s = new Square(); s.draw(); // square draw Abstract Method 추상메소드 추상클래스만이추상메소드를가질수있음 추상메소드는암시적으로가상메소드 virtual it 키워드와함께사용불가 메소드이름앞에 abstract 키워드사용 상속받는클래스에서반드시재정의 abstract class Ticket public virtual string StartTime( ) public abstract int Fare( ); // 강제성메소드명만정의 class BusTicket: Ticket public override string StartTime( ) public override int Fare( ) // 파생클래스에서선언 //abstract class & abstract method abstract class Printer public abstract void Print(); abstract class HPPrinter : Printer public abstract void SelfTest(); class HP640 : HPPrinter public override void Print() Console.WriteLine(" 문서를출력합니다."); public override void SelfTest() Console.WriteLine(" 프린터를자가진단합니다."); class AbstractTest public static void Main() HP640 myprinter = new HP640(); myprinter.print(); myprinter.selftest(); 문서를출력합니다. 프린터를자가진단합니다.

7 Sealed Class 봉인클래스및봉인클래스멤버 추가파생방지를위하여클래스는자신또는멤버를 sealed로선언하여다른클래스가상속하는것을막을수있음 봉인클래스 (sealed class) 는기본클래스로사용할수없음 - 그러므로추상클래스가될수도없음 클래스멤버선언에서 override 키워드앞에 sealed 키워드를사용하면멤버가봉인으로선언됨 이후에파생되는클래스에서는해당멤버가가상 (virtual) 이아니게됨. // sealed class public sealed class B // sealed method public class B : A public sealed override void DoWork() //sealed class & sealed method class Printer public virtual void Print() Console.WriteLine( 문서를출력합니다 ); class HPPrinter : Printer public sealed override void Print() Console.WriteLine( HP 프린터문서를출력합니다."); class SealedTest public static void Main() Printer myprinter = new Printer(); myprinter.print(); HPPrinter myprinter2 = new HPPrinter(); myprinter2.print(); 문서를출력합니다. HP 프린터문서를출력합니다. Multiple Inheritance 다중상속 (Multiple Inheritance) 란하나의클래스가여러개의클래스로부터상속을받는것 C# 에서는하나의클래스가동시에 2개이상의클래스에서상속받는것을지원하지않음 C# 에서는인터페이스 (interface) 를이용하여다중상속지원 Interfaces Interface 행동적인특성 ( 메소드, 속성, 인덱서, 이벤트 ) 만을정의 인터페이스는하위클래스에구현되어야하는기능을선언할시일반적으로이질적인클래스들이공통으로제공해야할메소드들을선언할때사용 다중상속을구현하기위한방법으로사용 class 대신 interface 키워드를사용하여선언 관례적으로 I 접두어사용 Interface 상속 public interface IToken : IBase int LineNumber( ); 인터페이스의메소드는구현부분이없이 string Name( ); ; 으로처리

8 Class & Interfaces 클래스 / 인터페이스관계 클래스 & 클래스 : 상속관계 클래스 & 인터페이스 : 구현관계 인터페이스 & 인터페이스 : 상속관계 클래스 & 인터페이스선언예 interface IMyInterface: IBase1, IBase2 여러개의인터페이스를 void MethodA(); 상속받은인터페이스는 void MethodB(); 상위인터페이스의 메소드를모두구현해주어야함 class ClassA: IFace1, IFace2 // class members, implementing interface 클래스와인터페이스를 class ClassB: BaseClass, IFace1, IFace2 함께상속받는경우 // class members, implementing interface 기본클래스가처음에위치 //interface using System; interface IScalable void ScaleX(float factor); void ScaleY(float factor); public abstract class DrawObject public DrawObject() public abstract void Print(); public class TextObject: DrawObject, IScalable private string text; public TextObject(string text) this.text = text; // implemention of IScalable.ScaleX() public void ScaleX(float factor) Console.WriteLine("ScaleX: 0 1", text, factor); // implemention of IScalable.ScaleY() public void ScaleY(float factor) Console.WriteLine("ScaleY: 0 1", text, factor); // implemention of fpi Print() public override void Print() Console.WriteLine( TextObject: 0", text); // TextObject 클래스객체를 array로처리 class InterfaceTest public static void Main() DrawObject[] darray = new DrawObject[10]; darray[0] = new TextObject("Text1"); darray[1] = new TextObject("Text2"); /* array ygets initialized here, with classes that derive from DiagramObject. Some of them implement IScalable. */ foreach (DrawObject d in darray) if (d is IScalable) IScalable scalable = (IScalable) d; scalable.scalex(0.1f); scalable.scaley(10.0f); d.print(); ScaleX: Text1 0.1 ScaleY: Text1 10 TextObject: Text1 ScaleX: Text2 0.1 ScaleY: Text2 10 TextObject: Text2 IComparable IEquatable IComparable 인터페이스 현객체를동일한형식의다른객체와비교하는 ( 인터페이스정렬순서를확인하는 ) ComparableTo 메소드를제공하는인터페이스 int CompareTo (Object obj) obj 인수는인터페이스를구현하는클래스와같은형식 리턴값은현객체가 obj 보다작으면 0보다작은수를, 같으면 0을, 크면 0보다큰수를리턴하도록구현 public class Age : IComparable public int CompareTo(object ( j obj) if (obj is Age) Age temp = (Age) obj; return m_value.compareto(temp.m_value); l throw new ArgumentException( Object is not Age ); protected int m_value; IEquatable 인터페이스 현객체가동일한형태의다른객체와같은지여부를확인하는 Equals 메소드를제공하는인터페이스 bool Equals (Object obj) obj 인수는인터페이스를구현하는클래스와같은형식 리턴값은현객체가 obj 과같으면 true, 다르면 false 를리턴하도록구현 public class Person : IEquatable<Person> public bool Equals(Person ( p) if (p is Person) return name.equals(p.name) && age.equals(p.age); throw new ArgumentException( Object is not Person ); public string name; public int age;

9 IEnumerable IEnumerable 인터페이스 Collections을반복하는열거자 (IEnumerator 객체 ) 를반환하는 GetEnumerator 메소드를제공하는인터페이스 IEnumerator GetEnumerator () IEnumerator 인터페이스 컬랙션의요소들을참조할수있는아래 3 메소드및속성을갖는인터페이스 object Current 컬랙션의현재요소를가져오는속성 bool MoveNext() 컬랙션의다음요소로이동하는메소드 void Reset() 컬랙션의첫번째요소앞의초기위치로설정하는메소드 //IEnumerable interface 구현 using System; Using System.Collections; public class Tokens : IEnumerable private string[] elements; Tokens(string source, char[] delimiters) elements = source.split(delimiters); // implemention of GetEnumerator() public IEnumerator GetEnumerator() return new TokenEnumerator(this); // implemention of TokenEnumerator private class TokenEnumerator : IEnumerator private int position = -1; private Tokens t; public TokenEnumerator(Tokens t) this.t = t; public void Reset() position = -1; public bool MoveNext() if (position < t.elements.length 1) position++; return true; else return false; public object Current get return t.elements[position]; // Token 테스트 class EnumeratorTest public static void Main() Tokens f = new Tokens( This is a sample test., new char [], - ); foreach (string item in f) Console.WriteLine(item); Interface vs. Abstract Class 인터페이스와추상클래스의공통점과차이점 모두추상의의미 new 키워드를사용하여객체를생성하는것이불가능 파생클래스에서모든메서드를구현하였을경우기능을발휘 클래스와메서드가 abstract로선언되어있다면인터페이스로변환가능 Interface vs. Abstract Class 변환예 ( 추상클래스 인터페이스 ) // 추상클래스 abstract public class StarPlayer public abstract void GoodPlay(); public abstract void Handsome(); // 인터페이스 interface IStarPlayer void GoodPlay(); void Handsome(); 모든추상클래스가인터페이스로될수없음 추상메서드는 override 키워드사용 추상클래스는다중상속을지원하지않음

10 Interface 의암시적구현 public interface IGunner void Shoot(); public interface ISoccerPlayer void Shoot(); public class Gunner : IGunner public void Shoot() Console.WriteLine( 총쏘기 ); public class SoccerPlayer : ISoccerPlayer public void Shoot() Console.WriteLine( 공차기 ); // Main () 함수중간생략 Gunner g = new Gunner(); g.shoot(); // 총쏘기 SoccerPlayer s = new SoccerPlayer(); s.shoot(); // 공차기 Interface 의명시적구현 public class GunPlayer : IGunner, ISoccerPlayer void IGunner.Shoot() Console.WriteLine( WriteLine( 총쏘기 ); void ISoccerPlayer.Shoot() Console.WriteLine( 공차기 ); // Main () 함수중간생략 GunPlayer p = new GunPlayer(); ((IGunner)p).Shoot(); // 총쏘기 - IGunner로형변환 ((ISoccerPlayer)p).Shoot(); // 공차기 ISoccerPlayer 로형변환 // 또는아래와같이해당객체를만들고난후참조하도록하는방법을사용 IGunner g = new GunPlayer(); g.shoot(); ISoccerPlayer s = new GunPlayer(); s.shoot(); // IGunner 로형변환 // 총쏘기 // ISoccerPlayer 로형변환 // 공차기 Base/Derived Conversion: Casting Upcasting 하위클래스가상위클래스로의암시적인형변환 Downcasting 상위클래스가하위클래스로의형변환 (downcasting) 시명시적형변환 (explicit type conversion) 연산자필요 실행시참조변수가가리키는실제객체의데이터형검사 실패하는경우 InvalidCastException 발생 class UpcastDowncastTest static void Main() MyBaseClass c = new MyBaseClass(); MyDerivedClass d = new MyDerivedClass(); c = d; // upcasting d = (MyDerivedClass) c; // downcasting is & as Operator is 연산자 데이터의형변환이가능하면 true 반환 as 연산자 객체사이의형변환연산자 오류발생시 exception 발생없이 null 반환 Bird b; if (a is Bird) b = (Bird) a; // 안전한형변환 else Console.WriteLine("Not a Bird"); Bird b = a as Bird; // 형변환 if (b == null) Console.WriteLine("Not a bird");

11 Object Type Conversion 모든참조형 ( 예, class) 은 System.Object으로부터파생 즉, 모든참조형은 System.Object으로형변환이가능 class Bird class Parrot : Bird class ObjectTypeConversionTest static void Main() Bird b = new Bird(); Parrot p = new Parrot(); object o = p; // object 형변환 Bird b2 = o as Bird; // object형을 Bird 형으로변환 if (b2 == null) Console.WriteLine( Object is not a bird"); else Console.WriteLine( Object is a bird ); Boxing and Unboxing Boxing 값형 -> 참조형으로바꾸는것 ( 암시적변환 ) Unboxing 참조형 -> 값형으로바꾸는것 ( 명시적변환 ) memory 137 a // boxing o1 int a = 137; int object o1 = a; b object o2 = o1; o2 // unboxing int b = (int)o2; User-Defined Type Conversion 클래스나구조체의형을다른클래스, 구조체혹은기본자료형으로변환가능 형변환연산자 (conversion operator) 를정의 class Sample int number = 42; public static implicit operator string (Sample op) return op.tostring(); // 문자열로형변환하는연산자를정의했다면 ToString 메소드도정의해야함 public override string ToString () return Object: value= + number; // System.Object.ToString 메소드재정의 // 형변환 Sample obj; string s = obj; // implicit대신 explicit으로선언되면 string s = (Sample)obj; 값형과참조형의비교 값형경우 == 와!= 연산자를사용하여값을비교 참조형경우 == 와!= 연산자를사용하여비교할수없음 class Point public int x; public int y; class PointClassComparisonTest C i t static void Main() int i = 1; int j = 1; // 값형의비교는 i==j는 true Point p1 = new Point(); Point p2 = new Point(); Point p3 = p1; // 같은객체를참조하므로 p1==p3는 true p1.x = 1; p1.y = 1; p2.x = 1; p2.y = 1; if (p1 == p2) // 참조형의비교는 p1==p2 p 는 false Console.WriteLine( p1과 p2가같다 ); else Console.WriteLine( p1 과 p2 가다르다 );

JAVA PROGRAMMING 실습 08.다형성

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

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

C++ Programming

C++ Programming C++ Programming 상속과다형성 Seo, Doo-okok clickseo@gmail.com http://www.clickseo.com 목 차 상속의이해 상속과다형성 다중상속 2 상속과다형성 객체의이해 상속클래스의객체의생성및소멸 상속의조건 상속과다형성 다중상속 3 상속의이해 상속 (Inheritance) 클래스에구현된모든특성 ( 멤버변수와멤버함수 )

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 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

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

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

쉽게 풀어쓴 C 프로그래밍

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

More information

Microsoft PowerPoint - 2강

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

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

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 프레젠테이션

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

More information

쉽게 풀어쓴 C 프로그래밍

쉽게 풀어쓴 C 프로그래밍 제 11 장상속 1. 상속의개념을이해한다. 2. 상속을이용하여자식클래스를작성할수있다. 3. 상속과접근지정자와의관계를이해한다. 4. 상속시생성자와소멸자가호출되는순서를이해한다. 이번장에서만들어볼프로그램 class Circle { int x, y; int radius;... class Rect { int x, y; int width, height;... 중복 상속의개요

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

<4D F736F F F696E74202D20C1A63038C0E520C5ACB7A1BDBABFCD20B0B4C3BC4928B0ADC0C729205BC8A3C8AF20B8F0B5E55D>

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

More information

No Slide Title

No Slide Title 상속 이충기 명지대학교컴퓨터공학과 상속 Q: 건설회사는기존아파트와조금다르거나추가적인특징들을가진새아파트를지을때어떻게하는가? A: 2 상속 상속 (inheritance) 은클래스들을연관시키는자연스럽고계층적인방법이다. 상속은객체지향프로그래밍의가장중요한개념중의하나이다. 상속은 은 이다 라는관계 (is-a relationship) 를나타낸다. 이관계를적용하여클래스들을상하관계로연결하는것이상속이다.

More information

PowerPoint 프레젠테이션

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

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

PowerPoint Template

PowerPoint Template 16-1. 보조자료템플릿 (Template) 함수템플릿 클래스템플릿 Jong Hyuk Park 함수템플릿 Jong Hyuk Park 함수템플릿소개 함수템플릿 한번의함수정의로서로다른자료형에대해적용하는함수 예 int abs(int n) return n < 0? -n : n; double abs(double n) 함수 return n < 0? -n : n; //

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

Microsoft PowerPoint - additional08.ppt [호환 모드]

Microsoft PowerPoint - additional08.ppt [호환 모드] 8. 상속과다형성 (polymorphism) 상속된객체와포인터 / 참조자의관계 정적바인딩과동적바인딩 virtual 소멸자 Jong Hyuk Park 상속의조건 public 상속은 is-a 관계가성립되도록하자. 일반화 ParttimeStd 구체화 2 상속의조건 잘못된상속의예 현실세계와완전히동떨어진모델이형성됨 3 상속의조건 HAS-A( 소유 ) 관계에의한상속!

More information

PowerPoint 프레젠테이션

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

More information

Slide 1

Slide 1 SeoulTech 2011-2 nd 프로그래밍입문 (2) Chapter 14. 상속 박종혁교수 (http://www.parkjonghyuk.net) Tel: 970-6702 Email: jhpark1@snut.ac.kr Learning Objectives 상속의기본 파생클래스와생성자 protected: 제한자 멤버함수의재정의 상속되지않는함수들 상속을이용한프로그래밍

More information

설계란 무엇인가?

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

More information

JAVA PROGRAMMING 실습 07. 상속

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

More information

Microsoft PowerPoint - C++ 5 .pptx

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

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

JAVA PROGRAMMING 실습 02. 표준 입출력

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

More information

PowerPoint Presentation

PowerPoint Presentation 객체지향프로그래밍 클래스와메소드심층연구 ( 실습 ) 손시운 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

Microsoft PowerPoint - CSharp-10-예외처리

Microsoft PowerPoint - CSharp-10-예외처리 10 장. 예외처리 예외처리개념 예외처리구문 사용자정의예외클래스와예외전파 순천향대학교컴퓨터학부이상정 1 예외처리개념 순천향대학교컴퓨터학부이상정 2 예외처리 오류 컴파일타임오류 (Compile-Time Error) 구문오류이기때문에컴파일러의구문오류메시지에의해쉽게교정 런타임오류 (Run-Time Error) 디버깅의절차를거치지않으면잡기어려운심각한오류 시스템에심각한문제를줄수도있다.

More information

PowerPoint Presentation

PowerPoint Presentation 객체지향프로그래밍 상속 손시운 ssw5176@kangwon.ac.kr 상속이란? 상속의개념은현실세계에도존재한다. 2 상속의장점 상속의장점 상속을통하여기존클래스의필드와메소드를재사용 기존클래스의일부변경도가능 상속을이용하게되면복잡한 GUI 프로그램을순식간에작성 상속은이미작성된검증된소프트웨어를재사용 신뢰성있는소프트웨어를손쉽게개발, 유지보수 코드의중복을줄일수있다. 3

More information

1. auto_ptr 다음프로그램의문제점은무엇인가? void func(void) int *p = new int; cout << " 양수입력 : "; cin >> *p; if (*p <= 0) cout << " 양수를입력해야합니다 " << endl; return; 동적할

1. auto_ptr 다음프로그램의문제점은무엇인가? void func(void) int *p = new int; cout <<  양수입력 : ; cin >> *p; if (*p <= 0) cout <<  양수를입력해야합니다  << endl; return; 동적할 15 장기타주제들 auto_ptr 변환함수 cast 연산자에의한명시적형변환실행시간타입정보알아내기 (RTTI) C++ 프로그래밍입문 1. auto_ptr 다음프로그램의문제점은무엇인가? void func(void) int *p = new int; cout > *p; if (*p

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

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

Microsoft PowerPoint - additional07.ppt [호환 모드]

Microsoft PowerPoint - additional07.ppt [호환 모드] 보충자료 7. 상속 (inheritance) 의이해 상속의기본개념 상속의생성자, 소멸자 protected 멤버 Jong Hyuk Park 상속의기본개념 Jong Hyuk Park 상속의기본개념 상속의예 1 " 철수는아버지로부터좋은목소리와큰키를물려 받았다." 상속의예 2 "Student 클래스가 Person 클래스를상속한다." 아버지 Person 철수 Stduent

More information

쉽게 풀어쓴 C 프로그래밍

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

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 - java2-lecture3.ppt [\310\243\310\257 \270\360\265\345])

(Microsoft PowerPoint - java2-lecture3.ppt [\310\243\310\257 \270\360\265\345]) Class Class, Collections 514770-1 2017 년봄학기 3/22/2017 박경신 클래스 (Class) 객체의속성과행위선언 객체의설계도혹은틀 객체 (Object) 클래스의틀로찍어낸실체 메모리공간을갖는구체적인실체 클래스를구체화한객체를인스턴스 (instance) 라고부름 객체와인스턴스는같은뜻으로사용 클래스구조 클래스접근권한, public 다른클래스들에서이클래스를사용하거나접근할수있음을선언

More information

Microsoft PowerPoint - Chap12-OOP.ppt

Microsoft PowerPoint - Chap12-OOP.ppt 객체지향프로그래밍 (Object Oriented Programming) 12 장강사 강대기 차례 (Agenda) 멤버에대한동적메모리할당 암시적 / 명시적복사생성자 암시적 / 명시적오버로딩대입연산자 생성자에 new 사용하기 static 클래스멤버 객체에위치지정 new 사용하기 객체를지시하는포인터 StringBad 클래스 멤버에포인터사용 str static 멤버

More information

C++ Programming

C++ Programming C++ Programming 클래스와데이터추상화 Seo, Doo-okok clickseo@gmail.com http://www.clickseo.com 목 차 객체지향프로그래밍 클래스와객체 2 객체지향프로그래밍 객체지향언어 (Object-Oriented Language) 프로그램을명령어의목록으로보는시각에서벗어나여러개의 독립된단위, 즉 객체 (Object) 들의모임으로파악

More information

PowerPoint Template

PowerPoint Template 9. 객체지향프로그래밍 대구가톨릭대학교 IT 공학부 소프트웨어공학연구실 목차 2 9.1 개요 9.2 객체지향프로그래밍언어 9.3 추상자료형 9.4 상속 9.5 동적바인딩 9.1 객체지향의개념 (1) 3 객체지향의등장배경 소프트웨어와하드웨어의발전불균형 소프트웨어모듈의재사용과독립성을강조 객체 (object) 란? 우리가다루는모든사물을일컫는말 예 ) 하나의점, 사각형,

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

쉽게 풀어쓴 C 프로그래밍

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

More information

Microsoft PowerPoint - 6주차.pptx

Microsoft PowerPoint - 6주차.pptx 1 6 주차 클래스상속 유전적상속과객체지향상속 2 그래요우리를꼭닮았어요 아빠의유산이다. 나를꼭닮았군 유산상속 유전적상속 : 객체지향상속 생물 동물 식물 상속받음 어류사람나무풀 유전적상속과관계된생물분류 C++ 에서의상속 (Inheritance) 3 C++ 에서의상속이란? 클래스사이에서상속관계정의 객체사이에는상속관계없음 기본클래스의속성과기능을파생클래스에물려주는것

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

PowerPoint Template

PowerPoint Template 7. 상속 (inheritance) 의이해 상속의기본개념 상속의생성자, 소멸자 protected 멤버 Jong Hyuk Park 상속의기본개념 Jong Hyuk Park 상속의기본개념 상속의예 1 " 철수는아버지로부터좋은목소리와큰키를물려받았다." 상속의예 2 "Student 클래스가 Person 클래스를상속한다." 아버지 Person 철수 Stduent 3

More information

Microsoft PowerPoint - chap11

Microsoft PowerPoint - chap11 10 장객체 - 지향프로그래밍 II 상속 상속 (Inheritance) 상속이란무엇인가? 기존의클래스로부터새로운클래스를유도하는것 자식클래스는부모클래스의메쏘드와데이터를상속 자식클래스에새로운변수나메쏘드를추가할수있다. 기존클래스 부모클래스 (parent class), 수퍼클래스 (superclass), 기반클래스 (base class) 유도클래스 자식클래스 (child

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

1. 상속의기본개념 다음과같은문제를위한클래스설계 자동차 속성 : 색상, 배기량, 현재속도 메서드 : 가속하라, 멈춰라, 시동을켜라 트럭 속성 : 색상, 배기량, 현재속도, 최대중량 메서드 : 가속하라, 멈춰라, 시동을켜라 택시 속성 : 색상, 배기량, 현재속도, 요금,

1. 상속의기본개념 다음과같은문제를위한클래스설계 자동차 속성 : 색상, 배기량, 현재속도 메서드 : 가속하라, 멈춰라, 시동을켜라 트럭 속성 : 색상, 배기량, 현재속도, 최대중량 메서드 : 가속하라, 멈춰라, 시동을켜라 택시 속성 : 색상, 배기량, 현재속도, 요금, 8 장상속 상속의기본개념상속관련문제제기 base 클래스의접근제어와 protected 멤버상속관계에서의생성자와소멸자함수재정의 (function overriding) 디폴트액세스지정자와구조체 derived 클래스로부터의상속다중상속 virtual base 클래스 derived 클래스의디폴트복사생성자와디폴트대입연산자 private 생성자의사용 C++ 프로그래밍입문

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

Chapter 6 Objects and Classes

Chapter 6 Objects and Classes 11 장상속과다형성 1 강의목표 상속 (inheritance) 을이용하여기본클래스 (base class) 로부터파생클래스 (derived class) 생성 (11.2) 파생클래스유형의객체를기본클래스유형의매개변수 (parameter) 로전달함으로써일반화프로그래밍 (generic programming) 작업 (11.3) 생성자와소멸자의연쇄적처리 (chaining)

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

JVM 메모리구조

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

More information

JUNIT 실습및발표

JUNIT 실습및발표 JUNIT 실습및발표 JUNIT 접속 www.junit.org DownLoad JUnit JavaDoc API Document 를참조 JUNIT 4.8.1 다운로드 설치파일 (jar 파일 ) 을다운로드 CLASSPATH 를설정 환경변수에서설정 실행할클래스에서 import JUnit 설치하기 테스트실행주석 @Test Test 를실행할 method 앞에붙임 expected

More information

Microsoft PowerPoint - java2 [호환 모드]

Microsoft PowerPoint - java2 [호환 모드] 10 장객체- 지향프로그래밍 II 창병모 1 상속 창병모 2 상속 (Inheritance) 상속이란무엇인가? 기존의클래스로부터새로운클래스를유도하는것 자식클래스는부모클래스의메쏘드와데이터를상속 자식클래스에새로운변수나메쏘드를추가할수있다. 기존클래스 부모클래스 (parent class), 수퍼클래스 (superclass), 기반클래스 (base class) 유도클래스

More information

(Microsoft Word - \301\337\260\243\260\355\273\347.docx)

(Microsoft Word - \301\337\260\243\260\355\273\347.docx) 내장형시스템공학 (NH466) 중간고사 학번 : 이름 : 문제 배점 점수 1 20 2 20 3 20 4 20 5 10 6 10 7 15 8 20 9 15 합계 150 1. (20 점 ) 다음용어에대해서설명하시오. (1) 정보은닉 (Information Hiding) (2) 캡슐화 (Encapsulation) (3) 오버로딩 (Overloading) (4) 생성자

More information

1. 클래스와배열 int 형배열선언및초기화 int ary[5] = 1, 2, 3, 4, 5 ; for (int i = 0; i < 5; i++) cout << "ary[" << i << "] = " << ary[i] << endl; 5 장클래스의활용 1

1. 클래스와배열 int 형배열선언및초기화 int ary[5] = 1, 2, 3, 4, 5 ; for (int i = 0; i < 5; i++) cout << ary[ << i << ] =  << ary[i] << endl; 5 장클래스의활용 1 5 장클래스의활용 클래스와배열객체포인터 this 포인터멤버함수오버로딩디폴트매개변수의사용 friend ( 전역함수, 클래스, 멤버함수 ) 내포클래스지역클래스 static 멤버 const 멤버와 const 객체 explicit 생성자 C++ 프로그래밍입문 1. 클래스와배열 int 형배열선언및초기화 int ary[5] = 1, 2, 3, 4, 5 ; for (int

More information

Microsoft PowerPoint - Chapter 6.ppt

Microsoft PowerPoint - Chapter 6.ppt 6.Static 멤버와 const 멤버 클래스와 const 클래스와 static 연결리스트프로그램예 Jong Hyuk Park 클래스와 const Jong Hyuk Park C 의 const (1) const double PI=3.14; PI=3.1415; // 컴파일오류 const int val; val=20; // 컴파일오류 3 C 의 const (1)

More information

<322EBCF8C8AF28BFACBDC0B9AEC1A6292E687770>

<322EBCF8C8AF28BFACBDC0B9AEC1A6292E687770> 연습문제해답 5 4 3 2 1 0 함수의반환값 =15 5 4 3 2 1 0 함수의반환값 =95 10 7 4 1-2 함수의반환값 =3 1 2 3 4 5 연습문제해답 1. C 언어에서의배열에대하여다음중맞는것은? (1) 3차원이상의배열은불가능하다. (2) 배열의이름은포인터와같은역할을한다. (3) 배열의인덱스는 1에서부터시작한다. (4) 선언한다음, 실행도중에배열의크기를변경하는것이가능하다.

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

슬라이드 1

슬라이드 1 정적메모리할당 (Static memory allocation) 일반적으로프로그램의실행에필요한메모리 ( 변수, 배열, 객체등 ) 는컴파일과정에서결정되고, 실행파일이메모리에로드될때할당되며, 종료후에반환됨 동적메모리할당 (Dynamic memory allocation) 프로그램의실행중에필요한메모리를할당받아사용하고, 사용이끝나면반환함 - 메모리를프로그램이직접관리해야함

More information

쉽게 풀어쓴 C 프로그래밍

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

More information

[ 마이크로프로세서 1] 2 주차 3 차시. 포인터와구조체 2 주차 3 차시포인터와구조체 학습목표 1. C 언어에서가장어려운포인터와구조체를설명할수있다. 2. Call By Value 와 Call By Reference 를구분할수있다. 학습내용 1 : 함수 (Functi

[ 마이크로프로세서 1] 2 주차 3 차시. 포인터와구조체 2 주차 3 차시포인터와구조체 학습목표 1. C 언어에서가장어려운포인터와구조체를설명할수있다. 2. Call By Value 와 Call By Reference 를구분할수있다. 학습내용 1 : 함수 (Functi 2 주차 3 차시포인터와구조체 학습목표 1. C 언어에서가장어려운포인터와구조체를설명할수있다. 2. Call By Value 와 Call By Reference 를구분할수있다. 학습내용 1 : 함수 (Function) 1. 함수의개념 입력에대해적절한출력을발생시켜주는것 내가 ( 프로그래머 ) 작성한명령문을연산, 처리, 실행해주는부분 ( 모듈 ) 자체적으로실행되지않으며,

More information

1

1 1 1....6 1.1...6 2. Java Architecture...7 2.1 2SDK(Software Development Kit)...8 2.2 JRE(Java Runtime Environment)...9 2.3 (Java Virtual Machine, JVM)...10 2.4 JVM...11 2.5 (runtime)jvm...12 2.5.1 2.5.2

More information

Slide 1

Slide 1 SeoulTech 2011-2 nd 프로그래밍입문 (2) Chapter 15. 다형성과가상함수 박종혁교수 (http://www.parkjonghyuk.net) Tel: 970-6702 Email: jhpark1@snut.ac.kr Learning Objectives 가상함수 (Virtual Function) 기본 사후바인딩 (late binding) / 동적바인딩

More information

슬라이드 1

슬라이드 1 UNIT 12 상속과오버라이딩 로봇 SW 교육원 2 기 최상훈 학습목표 2 클래스를상속핛수있다. 메소드오버라이딩을사용핛수있다. 패키지선언과 import 문을사용핛수있다. 상속 (inheritance) 3 상속이란 기존의클래스를기반으로새로운클래스를작성 두클래스를부모와자식으로관계를맺어주는것 자식은부모의모든멤버를상속받음 연관된일렦의클래스에대핚공통적인규약을정의 class

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

제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

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

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

More information

슬라이드 1

슬라이드 1 4 장클래스다이어그램 구성요소 객체와클래스 클래스추출 한빛미디어 ( 주 ) 학습목표 클래스의개념과구성요소를이해한다. 클래스추출과관계를학습한다. 관계를코드로이해한다. 2 학습목표 클래스의구성요소 클래스이름 (class name) 공통의속성, 메서드 ( 오퍼레이션 ), 관계, 의미를공유하는객체들의집합에대한기술이다. 속성 (attributes) 클래스의구조적특성에이름을붙인것으로구조적특성에해당하는인스턴스가보유할수있는값의범위를기술한다.

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

4 장클래스와객체 클래스와객체 public과 private 구조체와클래스객체의생성과생성자객체의소멸과소멸자생성자와소멸자의호출순서디폴트생성자와디폴트소멸자멤버초기화멤버함수의외부정의멤버함수의인라인함수선언 C++ 프로그래밍입문

4 장클래스와객체 클래스와객체 public과 private 구조체와클래스객체의생성과생성자객체의소멸과소멸자생성자와소멸자의호출순서디폴트생성자와디폴트소멸자멤버초기화멤버함수의외부정의멤버함수의인라인함수선언 C++ 프로그래밍입문 4 장클래스와객체 클래스와객체 public과 private 구조체와클래스객체의생성과생성자객체의소멸과소멸자생성자와소멸자의호출순서디폴트생성자와디폴트소멸자멤버초기화멤버함수의외부정의멤버함수의인라인함수선언 C++ 프로그래밍입문 1. 클래스와객체 추상데이터형 : 속성 (attribute) + 메서드 (method) 예 : 자동차의속성과메서드 C++ : 주로 class

More information

17장 클래스와 메소드

17장 클래스와 메소드 17 장클래스와메소드 박창이 서울시립대학교통계학과 박창이 ( 서울시립대학교통계학과 ) 17 장클래스와메소드 1 / 18 학습내용 객체지향특징들객체출력 init 메소드 str 메소드연산자재정의타입기반의버전다형성 (polymorphism) 박창이 ( 서울시립대학교통계학과 ) 17 장클래스와메소드 2 / 18 객체지향특징들 객체지향프로그래밍의특징 프로그램은객체와함수정의로구성되며대부분의계산은객체에대한연산으로표현됨객체의정의는

More information

C++ Programming

C++ Programming C++ Programming 연산자다중정의 Seo, Doo-okok clickseo@gmail.com http://www.clickseo.com 목 차 연산자다중정의 C++ 스타일의문자열 2 연산자다중정의 연산자다중정의 단항연산자다중정의 이항연산자다중정의 cin, cout 그리고 endl C++ 스타일의문자열 3 연산자다중정의 연산자다중정의 (Operator

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

선형대수학 Linear Algebra

선형대수학  Linear Algebra 배열, 컬렉션, 인덱서 array, collection, indexer 소프트웨어학과 HCI 프로그래밍강좌 배열 배열 (array) 동일한자료형을다수선언 선언형식 데이터형식 [ ] 배열이름 = new 데이터형식 [ 개수 ]; int[ ] array = new int[5]; 인덱스 (index) 는 0 에서시작 scores[0] = 80; scores[1] =

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

Microsoft PowerPoint - java1-lecture6.ppt [호환 모드]

Microsoft PowerPoint - java1-lecture6.ppt [호환 모드] Class 접근제어 인터페이스 514760-1 2019 년봄학기 4/9/2019 박경신 Protected 는같은패키지내와파생클래스에서사용가능 public class Car { private boolean disel; // private은파생클래스에서사용하지못함 protected boolean gasoline; protected int wheel = 4; protected

More information

Microsoft PowerPoint - additional06.ppt [호환 모드]

Microsoft PowerPoint - additional06.ppt [호환 모드] 보조자료 6.Static 멤버와 const 멤버 클래스와 const 클래스와 static 연결리스트프로그램예 Jong Hyuk Park 클래스와 const Jong Hyuk Park 복습 : Const 키워드왜사용? C 의 const (1) const double PI=3.14; PI=3.1415; // 컴파일오류 const int val; val=20; //

More information

슬라이드 1

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

More information

PowerPoint Presentation

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

More information

JAVA PROGRAMMING 실습 05. 객체의 활용

JAVA PROGRAMMING 실습 05. 객체의 활용 2015 학년도 2 학기 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

More information

슬라이드 1

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

More information

구조체정의 자료형 (data types) 기본자료형 (primitive data types) : char, int, float 등과같이 C 언어에서제공하는자료형. 사용자정의자료형 (user-defined data types) : 다양한자료형을묶어서목적에따라새로운자료형을

구조체정의 자료형 (data types) 기본자료형 (primitive data types) : char, int, float 등과같이 C 언어에서제공하는자료형. 사용자정의자료형 (user-defined data types) : 다양한자료형을묶어서목적에따라새로운자료형을 (structures) 구조체정의 구조체선언및초기화 구조체배열 구조체포인터 구조체배열과포인터 구조체와함수 중첩된구조체 구조체동적할당 공용체 (union) 1 구조체정의 자료형 (data types) 기본자료형 (primitive data types) : char, int, float 등과같이 C 언어에서제공하는자료형. 사용자정의자료형 (user-defined

More information

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

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

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

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

교육자료

교육자료 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

오버라이딩 (Overriding)

오버라이딩 (Overriding) WindowEvent WindowEvent 윈도우가열리거나 (opened) 닫힐때 (closed) 활성화되거나 (activated) 비활성화될때 (deactivated) 최소화되거나 (iconified) 복귀될때 (deiconified) 윈도우닫힘버튼을누를때 (closing) WindowEvent 수신자 abstract class WindowListener

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

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

초보자를 위한 C# 21일 완성

초보자를 위한 C# 21일 완성 C# 21., 21 C#., 2 ~ 3 21. 2 ~ 3 21.,. 1~ 2 (, ), C#.,,.,., 21..,.,,, 3. A..,,.,.. Q&A.. 24 C#,.NET.,.,.,. Visual C# Visual Studio.NET,..,. CD., www. TeachYour sel f CSharp. com., ( )., C#.. C# 1, 1. WEEK

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

Microsoft PowerPoint - hci2-lecture12 [호환 모드]

Microsoft PowerPoint - hci2-lecture12 [호환 모드] Serialization C# Serialization 321190 2012 년가을학기 11/28/2012 박경신 Serializaiton( 직렬화 ) 란객체상태를지속시키거나전송할수있는형식으로변환하는과정으로, Serialization 반대로다시객체로변환하는것을 Deserialization 임 Serialization i 을사용하는이유 객체의상태를저장소에보존했다가나중에똑같은복사본을다시만들기위하거나,

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 프로그래밍 클래스와객체 I 이번시간에서학습할내용 클래스와객체 객체의일생 메소드 필드 UML 직접클래스를작성해봅시다. 클래스의구성 클래스 (class) 는객체의설계도라할수있다. 클래스는필드와메소드로이루어진다. 필드 (field) 는객체의속성을나타낸다. 메소드 (method) 는객체의동작을나타낸다. 클래스정의의예 class Car { // 필드정의 public int speed;

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

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 클래스 ( 계속 ) 배효철 th1g@nate.com 1 목차 인스턴스멤버와 this 객체의소멸과가비지 정적멤버와 static final 필드와상수 패키지 접근제한자 Getter와 Setter 2 목차 인스턴스멤버와 this 객체의소멸과가비지 정적멤버와 static final 필드와상수 패키지 접근제한자 Getter와 Setter 3 인스턴스멤버와 this 인스턴스멤버란?

More information

Microsoft PowerPoint 장강의노트.ppt

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

More information

C# 입문 : 이론과 실습

C# 입문 : 이론과 실습 클래스 파생클래스 구조체 네임스페이스 [2/50] 클래스 (Class) C# 프로그램의기본단위 재사용성 (reusability), 이식성 (portability), 유연성 (flexibility) 증가 객체를정의하는템플릿 객체의구조와행위를정의하는방법 자료추상화 (data abstraction) 의방법 객체 (Object) 클래스의인스턴스로변수와같은역할 객체를정의하기위해서는해당하는클래스를정의

More information