regina Wed Jan 10 03:16:04 2001 EDT
Modified files:
/phpdoc/kr/language oop.xml
Log:
Index: phpdoc/kr/language/oop.xml
diff -u phpdoc/kr/language/oop.xml:1.2 phpdoc/kr/language/oop.xml:1.3
--- phpdoc/kr/language/oop.xml:1.2 Tue Jan 9 16:41:17 2001
+++ phpdoc/kr/language/oop.xml Wed Jan 10 03:16:04 2001
@@ -1,11 +1,11 @@
- <chapter id="language.oop">
+ <chapter id="language.oop">
<title>Classes and Objects</title>
<sect1 id="keyword.class">
<title><literal>class</literal></title>
<para>
- A class is a collection of variables and functions working with
- these variables. A class is defined using the following syntax:
+ 클래스는 일련의 변수와 이 변수들을 사용하는 함수들의
+모음이다.
+ 클래스는 다음과 같은 방법으로 선언한다
<informalexample>
<programlisting role="php">
@@ -36,18 +36,16 @@
</para>
<para>
- This defines a class named Cart that consists of an associative
- array of articles in the cart and two functions to add and remove
- items from this cart.
+ 이 선언은 Cart라는 이름의 클래스로, 카트안에 들어있는
+물품을 위한
+ 한 개의 배열 변수와 cart에 물건을 넣거나 빼는 두 개의
+함수로 구성되어 있다.
</para>
<note><simpara>
In PHP 4, only constant initializers for <literal>var</literal>
variables are allowed. Use constructors for non-constant initializers.
</simpara></note>
<para>
- Classes are types, that is, they are blueprints for actual
- variables. You have to create a variable of the desired type with
- the new operator.
+ Classe는 Type으로, 실제 변수들의 청사진이라 할 수 있다.
+ 여러분은 new 연산자를 사용하여 원하는 type의 변수를
+생성하여야 한다.
</para>
<informalexample>
@@ -58,14 +56,17 @@
</informalexample>
<para>
- This creates an object $cart of the class Cart. The function
- add_item() of that object is being called to add 1 item of article
- number 10 to the cart. </para><para> Classes can be extensions of
- other classes. The extended or derived class has all variables and
- functions of the base class and what you add in the extended
- definition. This is done using the extends keyword. Multiple
- inheritance is not supported.
+ 위에 있는 예는 Cart 클래스의 $cart라는 object를 만드는
+것이다.
+ 이 object의 add_item() 함수를 호출하여 물품 번호 "10"번의
+물품 1개를 카트에 넣는다.
</para>
+ <para>
+ 클래스는 다른 클래스로 확장 될 수 있다.
+ 확장 혹은 파생된(extended or derived) 클래스는 base가 되는
+ 클래스의 모든 변수들과 함수들을 그대로 가지게 되고,
+ 여기에 추가로 확장된 선언을 할 수 있다.
+ 이를 위해 "extends"라는 키워드가 사용된다.
+ 두개 이상의 부모 클래스를 가지는 다중상속(Multiple
+inheritance)는 지원하지 않는다.
+ </para>
<informalexample>
<programlisting role="php">
@@ -80,11 +81,10 @@
</informalexample>
<para>
- This defines a class Named_Cart that has all variables and
- functions of Cart plus an additional variable $owner and an
- additional function set_owner(). You create a named cart the usual
- way and can now set and get the carts owner. You can still use
- normal cart functions on named carts:
+ 위의 예는 Cart 클래스의 변수와 함수에 $owner 변수와
+set_owner() 함수를
+ 추가한 Named_Cart라는 클래스의 선언이다. 여러분은
+이름붙은 카트(named cart)를
+ 사용하여 카트의 주인을 설정하고 찾아볼 수 있다.
+ 또한 기존의 카트(cart)에 있는 함수도 모두 사용할 수 있다.
</para>
<informalexample>
@@ -97,14 +97,12 @@
</informalexample>
<para>
- Within functions of a class the variable $this means this
- object. You have to use $this->something to access any variable or
- function named something within your current object.
+ 클래스 내부에 있는 함수에서 $this 라는 변수는 자기 자신
+object를 의미한다.
+ $this->something의 형태로 현재 object의 변수나 함수를
+사용하여야 한다.
</para>
<para>
- Constructors are functions in a class that are automatically
- called when you create a new instance of a class. A function
- becomes a constructor when it has the same name as the class.
+ 생성자(Constructor)는 해당 클래스의 새 인스턴스(새로 만든
+변수라고 생각해 두자)를
+ 만들 때 자동적으로 실행되는 함수를 의미한다. 클래스의
+이름과 같은 이름의 함수가 생성자가 된다.
</para>
<informalexample>
@@ -118,11 +116,10 @@
</informalexample>
<para>
- This defines a class Auto_Cart that is a Cart plus a constructor
- which initializes the cart with one item of article number "10"
- each time a new Auto_Cart is being made with "new". Constructors
- can also take arguments and these arguments can be optional, which
- makes them much more useful.
+ 위의 예는 Cart 클래스에 물품번호 10번의 물품을 한 개
+자동으로 추가하는
+ 생성자를 추가한 Auto_Cart라는 클래스의 선언이다. Auto_Cart는
+"new"로 생성된다.
+ 생성자는 또한 인수(argument)를 가질 수 있고, 이 인수들은
+default값을 가진 옵션으로 선언 할 수 있다.
+ 이 기능은 실제로 매우 유용하다.
</para>
<informalexample>
@@ -145,8 +142,8 @@
<caution>
<simpara>
- For derived classes, the constructor of the parent class is not
- automatically called when the derived class's constructor is
+ 파생된(derived) 클래스의 경우, 이 클래스의 생성자가
+호출될 때
+ 부모 클래스의 생성자는 자동으로 호출되지 않는다.
called.
</simpara>
</caution>