svn: /phpdoc/kr/trunk/language/oop5/ inheritance.xml

From: Date: Sun, 16 Nov 2014 01:44:30 +0000
Subject: svn: /phpdoc/kr/trunk/language/oop5/ inheritance.xml
Groups: php.doc.kr 
Request: Send a blank email to doc-kr+get-1968@lists.php.net to get a copy of this message
acidd15 Sun, 16 Nov 2014 01:44:30 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=335183 Log: initial translate. Changed paths: A phpdoc/kr/trunk/language/oop5/inheritance.xml Added: phpdoc/kr/trunk/language/oop5/inheritance.xml =================================================================== --- phpdoc/kr/trunk/language/oop5/inheritance.xml (rev 0) +++ phpdoc/kr/trunk/language/oop5/inheritance.xml 2014-11-16 01:44:30 UTC (rev 335183) @@ -0,0 +1,90 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- $Revision$ --> +<!-- EN-Revision: 334699 Maintainer: acidd15 Status: ready --> +<!-- Reviewed: no --> + + <sect1 xml:id="language.oop5.inheritance" xmlns="http://docbook.org/ns/docbook"> + <title>객체 상속</title> + <para> + 상속은 정착된 프로그래밍 원칙이며, PHP는 이 원칙을 객체모델에서 사용하고 있습니다. + 이 원칙은 많은 클래스와 객체들을 연관짓는 방법에 영향을 미칩니다. + </para> + <para> + 예를 들면, class 를 확장했을때, subcalss 는 부모의 클래스로부터 모든 public, protected 메서드를 상속받게 됩니다. + 자식 클래스가 메서드를 재정의 하지 않는한, 원래 기능이 유지 됩니다. + </para> + <para> + 상속은 추상화된 기능을 정의하는데 유용합니다. 그리고, 공유된 기능을 위해 비슷한 객체들마다 기능을 재정의 하는 수고를 덜어줍니다. + </para> + + <note> + <para> + 자동로딩이 사용되지 않는한, 클래스는 사용되기 이전에 정의되어 있어야 합니다. + 클래스가 다른것으로 확장된다면, 자식 클래스 구조보다 부모클래스가 앞서 선언되어 있어야 합니다. + 이 규칙은 다른 클래스과 인터페이스를 상속받는 클래스들에게도 적용됩니다. + </para> + </note> + + <sect2 xml:id="language.oop5.inheritance.examples"> + <example xml:id="language.oop5.inheritance.examples.ex1"> + <title>상속 예제</title> + <programlisting role="php"> +<![CDATA[ +<?php + +class Foo +{ + public function printItem($string) + { + echo 'Foo: ' . $string . PHP_EOL; + } + + public function printPHP() + { + echo 'PHP is great.' . PHP_EOL; + } +} + +class Bar extends Foo +{ + public function printItem($string) + { + echo 'Bar: ' . $string . PHP_EOL; + } +} + +$foo = new Foo(); +$bar = new Bar(); +$foo->printItem('baz'); // Output: 'Foo: baz' +$foo->printPHP(); // Output: 'PHP is great' +$bar->printItem('baz'); // Output: 'Bar: baz' +$bar->printPHP(); // Output: 'PHP is great' + +?> +]]> + </programlisting> + </example> + </sect2> + + </sect1> + +<!-- Keep this comment at the end of the file +Local variables: +mode: sgml +sgml-omittag:t +sgml-shorttag:t +sgml-minimize-attributes:nil +sgml-always-quote-attributes:t +sgml-indent-step:1 +sgml-indent-data:t +indent-tabs-mode:nil +sgml-parent-document:nil +sgml-default-dtd-file:"~/.phpdoc/manual.ced" +sgml-exposed-tags:nil +sgml-local-catalogs:nil +sgml-local-ecat-files:nil +End: +vim600: syn=xml fen fdm=syntax fdl=2 si +vim: et tw=78 syn=sgml +vi: ts=1 sw=1 +--> Property changes on: phpdoc/kr/trunk/language/oop5/inheritance.xml ___________________________________________________________________ Added: svn:eol-style + native Added: svn:keywords + Id Rev Revision Date LastChangedDate LastChangedRevision Author LastChangedBy HeadURL URL

« previous php.doc.kr (#1968) next »