캡슐화: 두 판 사이의 차이

내용 삭제됨 내용 추가됨
Chobot (토론 | 기여)
잔글 봇:인터위키 링크 19 개가 위키데이터Q1305241 항목으로 옮겨짐. 이동 완료.; 예쁘게 바꿈
1번째 줄:
'''캡슐화'''({{llang|en|encapsulation}})는 [[객체 지향 프로그래밍]]에서 다음 2가지 측면이 있다:<ref>Michael Lee Scott, ''Programming language pragmatics'', Edition 2, Morgan Kaufmann, 2006, ISBN 0-12-633951-1, p. 481: "Encapsulation mechanisms enable the programmer to group data and the subroutines that operate on them together in one place, and to hide irrelevant details from the users of an abstraction."</ref><ref>Nell B. Dale, Chip Weems, ''Programming and problem solving with Java'', Edition 2, Jones & Bartlett Publishers, 2007, ISBN 0-7637-3402-0, p. 396</ref>
* 객체의 속성(data fields)과 행위(메서드, methods)를 하나로 묶고,<ref>Wm. Paul Rogers, [http://www.javaworld.com/javaworld/jw-05-2001/jw-0518-encapsulation.html?page=9 ''Encapsulation is not information hiding''], JavaWorld.com, 05/18/01</ref><ref>Thomas M. Connolly, Carolyn E. Begg, ''Database systems: a practical approach to design, implementation, and management'', Edition 4, Pearson Education, 2005, ISBN 0-321-21025-5, Chapter 25, "Introduction to Object DMBS", section "Object-oriented concepts", p. 814</ref>
* 실제 구현 내용 일부를 외부에 감추어 은닉한다.<ref>[[John C. Mitchell]], ''Concepts in programming languages'', Cambridge University Press, 2003, ISBN 0-521-78098-5, p.522</ref><ref name=Pierce>{{cite book|last=Pierce|first=Benjamin|authorlink=Benjamin C. Pierce|title=[[Types and Programming Languages]]|publisher=MIT Press|year=2002|isbn=0-262-16209-1}} p. 266</ref>
23번째 줄:
class Car {
// Data Fields ///////////////
public: // 지금부터 선언되는 멤버변수와 함수는 모두 접근 허용.
int year;
char maker[50];
30번째 줄:
int capEngine;
 
private: // 지금부터 선언되는 멤버변수와 함수는 자기 클래스에서만 접근 허용.
char ecu[20];
char colorCode[30];
42번째 줄:
int getCapEngine() { return capEngine; }
 
protected: // 자기 클래스 내부와 상속클래스에서 접근 허용한다.
char* getEcuType() { return ecu; }
char* getColorCode() { return colorCode; }
61번째 줄:
[[분류:프로그래밍 언어]]
[[분류:객체 지향 프로그래밍]]
 
[[bs:Zatvorenost]]
[[de:Datenkapselung (Programmierung)]]
[[en:Encapsulation (object-oriented programming)]]
[[fa:کپسوله‌سازی (علم رایانه)]]
[[fi:Kapselointi]]
[[fr:Encapsulation (programmation)]]
[[he:כימוס]]
[[it:Incapsulamento (informatica)]]
[[ja:カプセル化]]
[[lt:Inkapsuliacija]]
[[nl:Inkapseling]]
[[pl:Hermetyzacja (informatyka)]]
[[pt:Encapsulamento]]
[[ru:Инкапсуляция (программирование)]]
[[sr:Енкапсулација (објектно-оријентисано програмирање)]]
[[sv:Inkapsling (Information Hiding)]]
[[ta:உறைபொதியாக்கம் (நிரலாக்கம்)]]
[[tr:Kapsülleme]]
[[uk:Інкапсуляція]]