diff options
author | Peter Bengtsson <mail@peterbe.com> | 2021-07-07 21:57:08 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-08 10:57:08 +0900 |
commit | 0d13feed6a627047449d99af02d1fb55bbfad1a9 (patch) | |
tree | bb7efedc3137bfea1c69f510617b602009d58b3d /files/ko/orphaned/web/javascript/differential_inheritance_in_javascript | |
parent | ff9ea0cf9f0ea6217deefa7ad0dba35bf7f6c45e (diff) | |
download | translated-content-0d13feed6a627047449d99af02d1fb55bbfad1a9.tar.gz translated-content-0d13feed6a627047449d99af02d1fb55bbfad1a9.tar.bz2 translated-content-0d13feed6a627047449d99af02d1fb55bbfad1a9.zip |
delete conflicting/orphaned in ko (#1423)
* delete conflicting/orphaned in ko
* forgot the redirects
Diffstat (limited to 'files/ko/orphaned/web/javascript/differential_inheritance_in_javascript')
-rw-r--r-- | files/ko/orphaned/web/javascript/differential_inheritance_in_javascript/index.html | 64 |
1 files changed, 0 insertions, 64 deletions
diff --git a/files/ko/orphaned/web/javascript/differential_inheritance_in_javascript/index.html b/files/ko/orphaned/web/javascript/differential_inheritance_in_javascript/index.html deleted file mode 100644 index 0d247bd7f8..0000000000 --- a/files/ko/orphaned/web/javascript/differential_inheritance_in_javascript/index.html +++ /dev/null @@ -1,64 +0,0 @@ ---- -title: Differential inheritance in JavaScript -slug: orphaned/Web/JavaScript/Differential_inheritance_in_JavaScript -translation_of: Web/JavaScript/Differential_inheritance_in_JavaScript -original_slug: Web/JavaScript/Differential_inheritance_in_JavaScript ---- -<h2 id="Introduction">Introduction</h2> - -<p>차등 상속(Differential Inheritance)은 자바 스크립트와 같은 프로토 타입 기반 프로그래밍 언어에서 사용되는 일반적인 상속 모델입니다. 대부분의 객체는 다른 일반적인 객체에서 파생되고 몇 가지 작은 측면에서만 차이가 있다는 원칙에 따라 동작합니다. 일반적으로 객체가 다른 다른 객체에 대한 포인터 목록을 내부적으로 유지합니다.</p> - -<h2 id="Example">Example</h2> - - - -<p>다음 코드는 개체를 "상속"하는 간단한 메서드 예제입니다.</p> - -<pre class="brush: js notranslate">Object.prototype.inherit = function(){ - // Create a new object with this as its prototype - var p = Object.create(this); - - /* actually not necessary: - // Apply the constructor on the new object - this.constructor.apply(p, arguments); - */ - - return p; -}; -</pre> - -<p>상속(<font face="Consolas, Liberation Mono, Courier, monospace">inherit)</font>을 사용하면 일반 프로토 타입에서보다 구체적인 개체를 간단히 파생시킬 수 있습니다. 다음은 상속 방법 및 차등 상속을 사용하여 점점 더 구체적인 객체를 구성하는 간단한 예입니다.</p> - -<pre class="brush: js notranslate">var root = {}; // Could be any object with any prototype object - -var record = root.inherit(); -record.toString = function(){ return "a Record"; }; - -var person = root.inherit(); -person.firstName = false; -person.lastName = false; -person.toString = function(){ - if (this.firstName) { - if (this.lastName) { - return this.firstName + " " + this.lastName; - } else { - return this.firstName; - } - } else if (this.lastName) { - return this.lastName; - } else { - return "a Person"; - } -}; - -JoePerson = person.inherit(); -JoePerson.firstName = "Joe"; -alert( JoePerson.toString() ); -</pre> - -<h2 id="See_also">See also</h2> - -<ul> - <li><a href="/en/JavaScript/Reference/Global_Objects/Object/create" title="create">Object.create</a></li> - <li><a href="/en-US/docs/Web/JavaScript/Guide/Inheritance_and_the_prototype_chain">inheritance and the prototype chain</a></li> -</ul> |