프로그래밍 언어 비교(객체 지향 프로그래밍)
Comparison of programming languages (object-oriented programming)| 비교요인 프로그래밍 언어의 |
|---|
| |
이 프로그래밍 언어의 비교는 C++, Java, Smalltalk, Object Pascal, Perl, Python 등과 같은 객체 지향 프로그래밍 언어가 데이터 구조를 어떻게 조작하는지 비교한다.
객체 구성 및 파괴
| 건설 | 파괴 | |
|---|---|---|
| ABAP 객체 | data variable type ref to class .[1] | [2][3] |
| APL(Dynalog) | variable←⎕NEW class «parameters» | ⎕EX 'variable' |
| C++(STL) | class variable«(parameters)»; 또는class *variable = new class«(parameters)»; | delete pointer; |
| C# | class variable = new class(parameters); | variable.Dispose();[3] |
| 자바 | [3] | |
| D | destroy(variable); | |
| eC | class «instance handle» { «properties/data members assignments, instance method overrides» } | delete instance handle; |
| 목표-C(Cocoa) | class *variable = [[class alloc ] init]; 또는 class *variable = [[class alloc ] initWithFoo:parameter «bar:parameter ...»]; | [variable release]; |
| 스위프트 | let variable = class(parameters) | |
| 파이톤 | variable = class(parameters) | del variable[3] (일반적으로 필요하지 않음) |
| Visual Basic 입니다.네트 | Dim variable As New class(parameters) | variable.Dispose()[3] |
| 소조 | Dim variable As New class(parameters) | variable = Nil |
| 에펠 | create variable 또는create «{TYPE}» variable.make_foo «(parameters)» 또는variable := create {TYPE} 또는variable := create {TYPE}.make_foo «(parameters)» | [3] |
| PHP | $variable = new class«(parameters)»; | unset($variable);[3] |
| 펄 5 | «my »$variable = class->new«(parameters)»; | undef($variable); |
| 라쿠 | «my »$variable = class.new«(parameters)»; | $variable.undefine; |
| 루비 | variable = class.new«(parameters)» | [3] |
| Windows PowerShell | $variable = New-Object «-TypeName» class ««-ArgumentList» parameters» | Remove-Variable «-Name» variable |
| OCAML | let variable = new class «parameters» 또는 let variable = object members end[4] | [3] |
| F# | let variable = «new »class(«parameters») | |
| 스몰토크 | 클래스는 오브젝트. 보통 수업 시간에 메시지를 보내세요. #new 또는 #new:, 및 기타 여러 가지 예: 포인트 x: 10 y: 20. 배열 다음 항목 포함: -1 다음 항목 포함: 3 다음 항목 포함: 2. | |
| 자바스크립트 | var variable = new class«(parameters)» 또는 var variable = { «key1: value1«, key2: value2 ...»»} | [3] |
| 객체 Pascal(델피) | ClassVar := ClassType.ConstructorName(parameters); | ClassVar.Free; |
| 스칼라 | 발랄하게 하다 오비지 = 새로운 오브젝트 // 매개 변수 없음 발랄하게 하다 오비지 = 새로운 오브젝트(arg0, arg1, arg2...) 발랄하게 하다 오비지 = 오브젝트(arg0, arg1, arg2...) // 사례 클래스 발랄하게 하다 오비지 = 새로운 오브젝트(arg0, arg1, param1 = 값1, ...) // 명명된 매개 변수 | [3] |
| 코볼 | INVOKE class "NEW" RETURNING variable 또는MOVE class::"NEW" TO variable | |
| 코브라 | variable «as class» = class(parameters) | variable.dispose |
| ISLISP | (setq variable (create (class <some-class> [:field-1 value-1 [:field-2 value-2] ..]))) | [3] |
계급선언
| 계급 | 의정서 | 네임스페이스 | |
|---|---|---|---|
| ABAP 객체 | class name definition «inheriting from parentclass». «interfaces: interfaces.» method_and_field_declarations endclass. | interface name. members endinterface. | 해당 없음 |
| APL(Dynalog) | :Class name «:parentclass» «,interfaces»members:EndClass | :Interface namemembers:EndInterface | :Namespace namemembers:EndNamespace |
| C++(STL) | class name« : public parentclasses[5]» { members }; | namespace name { members } | |
| C# | class name« : «parentclass»«, interfaces»» { members } | interface name« : parentinterfaces» { members } | |
| D | module name; | ||
| eC | class name« : base class» { «default member values assignments» «members» } | | namespace name; |
| 자바 | class name« extends parentclass»« implements interfaces» { members } | interface name« extends parentinterfaces» { members } | package name; members |
| PHP | namespace name; members | ||
| 목표-C | @interface name« : parentclass»[6]«< protocols >» { instance_fields } method_and_property_declarations @end [7] | @protocol name«< parentprotocols >» members @end | [8] |
| 스위프트 | class name« : «parentclass»«, protocols»» { members } | protocol name« : parentprotocols» { members } | |
| 파이톤 | class name«(parentclasses[5])»: | [9] | __all__ = [ member1,member2,... ] |
| Visual Basic 입니다.네트 | Class name« Inherits parentclass»« Implements interfaces» | Interface name« Inherits parentinterfaces» | Namespace name |
| 소조 | Class name« Inherits parentclass»« Implements interfaces» | Interface name« Inherits parentinterfaces» | Module name |
| 에펠 | class name« inherit parentclasses[5]» | 해당 없음 | |
| 펄 | package name; «@ISA = qw(parentclasses[5]);» members 1; | package name; members | |
| 라쿠 | class name «is parentclass «is parentclass ...[5]»» «does role «does role ...»» { members } | role name «does role «does role ...»» { members } | module name { members } |
| 루비 | class name« < parentclass» | module name | |
| Windows PowerShell | 해당 없음 | ||
| OCAML | class name «parameters» = object «(self)» «inherit parentclass «parameters» «inherit parentclass «parameters» ...[5]»» members end | module name | |
| F# | type name«(parameters)» «as this» = class «inherit parentclass«(parameters)» «as base»» members «interface interface with implementation «interface interface with implementation ...»» end | type name = interface members end | namespace name |
| 스몰토크 | [10] | [11] | |
| 자바스크립트(ES6) | class name «extends parentclass» { members } | ||
| 객체 Pascal(델피) |
| package name; members | |
| 스칼라 | 계급 콘크리트 클래스(건설업자 모조품) 연장하다 어버이클래스 와 함께 특성1 와 함께 특성2 와 함께 특성2 { // 회원 } | 특성 특성 이름 연장하다 기타Trait1 와 함께 기타트레이트2 와 함께 기타트레이트3 { // 회원 } | 꾸러미 이름을 붙이다 |
| 코볼 | CLASS-ID. name« INHERITS« FROM» parentclasses». FACTORY« IMPLEMENTS interfaces».class-membersEND FACTORY.OBJECT« IMPLEMENTS interfaces».instance-membersEND OBJECT.
| INTERFACE-ID. name« INHERITS« FROM» interfaces». members
| 해당 없음 |
| 코브라 | class name «inherits parentclass» «implements interfaces» | interface name «inherits parentinterfaces» | namespace name |
| ISLISP | (defclass name (base-class) ((x :initform 0 :accessor get-x :initarg x)) (:abstractp nil)) | ||
반원
생성자 및 소멸자
| 건설업자 | 파괴자 | 최종 결정자[12] | |
|---|---|---|---|
| ABAP 객체 | methods constructor «importing parameter = argument»[13] | 해당 없음 | |
| APL(Dynalog) | ∇ name:Implements Constructor «:Base «expr»»instructions∇ | ∇ name:Implements Destructorinstructions∇ | |
| C++(STL) | class(«parameters») «: initializers[14]» { instructions } | ~class() { instructions } | |
| C# | class(«parameters») { instructions } | void Dispose(){ instructions } | ~class() { instructions } |
| D | this(«parameters») { instructions } | ~this() { instructions } | |
| eC | class() { instructions } | ~class() { instructions } | |
| 자바 | class(«parameters») { instructions } | void finalize() { instructions } | |
| 에펠 | [15] | [16] | |
| 목표-C(Cocoa) | - (id)init { instructions... return self; } or | - (void)dealloc { instructions } | - (void)finalize { instructions } |
| 스위프트 | init(«parameters») { instructions } | deinit { instructions } | |
| 파이톤 | def __init__(self«, parameters»): | def __del__(self): | |
| Visual Basic 입니다.네트 | Sub New(«parameters») | Sub Dispose() | Overrides Sub Finalize() |
| 소조 | Sub Constructor(«parameters») | Sub Destructor() | |
| PHP | function __construct(«parameters») { instructions } | function __destruct() { instructions } | |
| 펄 | sub new { my ($class«, parameters») = @_; my $self = {}; instructions ... bless($self, $class); return $self; } | sub DESTROY { my ($self) = @_; instructions } | |
| 라쿠 | submethod BUILD { instructions } or | submethod DESTROY { instructions } | |
| 루비 | def initialize«(parameters)» | 해당 없음 | |
| Windows PowerShell | 해당 없음 | ||
| OCAML | initializer instructions[17] | 해당 없음 | |
| F# | do instructions or[18] | member this.Dispose() = instructions | override this.Finalize() = instructions |
| 자바스크립트 | function name(«parameters») { instructions }[19] | 해당 없음 | |
| 자바스크립트(ES6) | constructor(«parameters») { instructions } | ||
| 코볼 | 해당[20] 없음 | 해당 없음 | |
| 코브라 | cue init(parameters) | def dispose | |
| ISLISP | (defmethod initialize-object ((instance <class-name>) initvalues) | ||
필드
| 공중의 | 사유의 | 보호받는 | 친구 | |
|---|---|---|---|---|
| ABAP 객체 | public section.[21] data field type type. | private section.[21] data field type type. | protected section.[21] data field type type. | [22] |
| APL(Dynalog) | :Field Public field «← value» | :Field «Private» field «← value» | ||
| C++(STL) | public: type field; | private: type field; | protected: type field; | [23] |
| C# | public type field «= value»; | private type field «= value»; | protected type field «= value»; | internal type field «= value»; |
| D | package type field «= value»; | |||
| 자바 | protected type field «= value»; | type field «= value»; | ||
| eC | public type field; | private type field; | ||
| 에펠 | feature | feature {NONE} | feature {current_class} | feature {FRIEND} |
| 목표-C | @public type field; | @private type field; | @protected type field; | @package type field; |
| 스위프트 | 해당 없음 | |||
| 스몰토크 | 해당 없음 | [24] | 해당 없음 | |
| 파이톤 | self.field = value[25] | 해당[26] 없음 | 해당 없음 | |
| Visual Basic 입니다.네트 | Public field As type «= value» | Private field As type «= value» | Protected field As type «= value» | Friend field As type «= value» |
| 소조 | Public field As type «= value» | Private field As type «= value» | Protected field As type «= value» | 해당 없음 |
| PHP | public $field «= value»; | private $field «= value»; | protected $field «= value»; | |
| 펄 | $self->{field} = value;[25] | 해당 없음 | ||
| 라쿠 | has« type »$.field« is rw» | has« type »$!field | 해당 없음 | |
| 루비 | 해당 없음 | @field = value[25] | ||
| Windows PowerShell | Add-Member | 해당 없음 | ||
| OCAML | 해당 없음 | val «mutable» field = value | 해당 없음 | |
| F# | 해당 없음 | let «mutable» field = value | 해당 없음 | |
| 자바스크립트 | this.field = value [25] | |||
| 코볼 | 해당 없음 | 필드 절에 [27]준거하다 | 해당 없음 | 해당 없음 |
| 코브라 | var field «as type» «= value» | var __field «as type» «= value» | var _field «as type» «= value» | |
| ISLISP | (field :initform value :accessor accessor-name :initarg keyword) | |||
방법들
| 기본/기초 방식 | 가치평가법 | ||
|---|---|---|---|
| ABAP 객체 | methods name «importing parameter = argument» «exporting parameter = argument» «changing parameter = argument» «returning value(parameter)»[28] | [29] | |
| APL(Dynalog) | ∇ «left argument» name «right arguments»instructions∇ | ∇ result ← «left argument» name «right arguments»instructions∇ | |
C++[30]
메소드의 구현은 보통 다음과 같은 구문으로 별도의 소스 파일로 제공된다.
| void foo(«parameters») { instructions } | type foo(«parameters») { instructions ... return value; } | |
| C# | |||
| D | |||
| 자바 | |||
| eC | void ««type of 'this'»::»foo(«parameters») { instructions } | type ««type of this»::»foo(«parameters») { instructions ... return value; } | |
| 에펠 | foo ( «parameters» ) | foo ( «parameters» ): TYPE | |
| 목표-C | - (void)foo«:parameter «bar:parameter ...»» { instructions } | - (type)foo«:parameter «bar:parameter ...»» { instructions... return value; } | |
| 스위프트 | func foo(«parameters») { instructions } | func foo(«parameters») -> type { instructions... return value } | |
| 파이톤 | def foo(self«, parameters»): | def foo(self«, parameters»): | |
| Visual Basic 입니다.네트 | Sub Foo(«parameters») | Function Foo(«parameters») As type | |
| 소조 | Sub Foo(«parameters») | Function Foo(«parameters») As type | |
| PHP | function foo(«parameters»)«: void» { instructions } | function foo(«parameters»)«: type» { instructions ... return value; } | |
| 펄 | sub foo { my ($self«, parameters») = @_; instructions } | sub foo { my ($self«, parameters») = @_; instructions ... return value; } | |
| 라쿠 | «has »«multi »method foo(««$self: »parameters») { instructions } | «has «type »»«multi »method foo(««$self: »parameters») { instructions ... return value; } | |
| 루비 | def foo«(parameters)» | def foo«(parameters)» | |
| Windows PowerShell | Add-Member «-MemberType» ScriptMethod «-Name» foo «-Value» { «param(parameters)» instructions } -InputObject variable | Add-Member «-MemberType» ScriptMethod «-Name» foo «-Value» { «param(parameters)» instructions ... return value } -InputObject variable | |
| OCAML | 해당 없음 | method foo «parameters» = expression | |
| F# | member this.foo(«parameters») = expression | ||
| 자바스크립트 | this.method = function(«parameters») {instructions} [32] | this.method = function(«parameters») {instructions... return value;} [32] | |
| 자바스크립트(ES6) | foo(«parameters») {instructions} | foo(«parameters») {instructions... return value;} | |
| 코볼 | METHOD-ID. foo. instructions
| METHOD-ID. foo. instructions
| |
| 코브라 | def foo(parameters) | def foo(parameters) as type | |
| ISLISP | (defgeneric method (arg1 arg2)) |
특성.
"Bar"라는 이름의 자산을 선언하는 방법
수동으로 구현됨
| 읽기-쓰기 | 읽기 전용의 | 쓰기 전용 | |
|---|---|---|---|
| ABAP 객체 | 해당 없음 | ||
| APL(Dynalog) | :Property Bar∇ result ← Getinstructions∇∇ Set argumentsinstructions∇:EndProperty Bar | :Property Bar∇ result ← Getinstructions∇:EndProperty Bar | :Property Bar∇ Set argumentsinstructions∇:EndProperty Bar |
| C++(STL) | 해당 없음 | ||
| C# | type Bar { | type Bar { get { instructions ... return value; } } | type Bar { set { instructions } } |
| D | @property type bar() { instructions ... return value; } | @property type bar() { instructions ... return value; } | @property type bar(type value) { instructions ... return value; } |
| eC | property type Bar { | property type Bar { get { instructions ... return value; } } | property type Bar { set { instructions } } |
| 자바 | 해당 없음 | ||
| 목표-C 2.0(Cocoa) | @property (readwrite) type bar; 그 다음엔 안에 @implementation | @property (readonly) type bar; 그 다음엔 안에 @implementation | 해당 없음 |
| 스위프트 | var bar : type { get { instructions } set«(newBar)» { instructions } } | var bar : type { instructions } | 해당 없음 |
| 에펠 | feature -- Access | ||
| 파이톤 | def setBar(self, value): [33] | def getBar(self): | def setBar(self, value): |
| Visual Basic 입니다.네트 | Property Bar() As type | ReadOnly Property Bar() As type | WriteOnly Property Bar() As type |
| 소조 | ComputedProperty Bar() As type | ComputedProperty Bar() As type | ComputedProperty Bar() As type |
| PHP | function __get($property) { | function __get($property) { | function __set($property, $value) { |
| 펄 | sub Bar { | sub Bar { | sub Bar { |
| 라쿠 | 해당 없음 | ||
| 루비 | def bar | def bar | def bar=(value) |
| Windows PowerShell | Add-Member | Add-Member | Add-Member |
| OCAML | 해당 없음 | ||
| F# | member this.Bar with get() = expression and set(value) = expression | member this.Bar = expression | member this.Bar with set(value) = expression |
| 자바스크립트(ES6) | get bar(«parameters») { instructions ... return value}set bar(«parameters») { instructions } | get bar(«parameters») { instructions ... return value} | set bar(«parameters») { instructions } |
| 코볼 | METHOD-ID. GET PROPERTY bar. instructions
instructions
| METHOD-ID. GET PROPERTY bar. instructions
| METHOD-ID. SET PROPERTY bar. instructions
|
| 코브라 | pro bar «as type» | get bar «as type» | set bar «as type» |
| ISLISP | 해당 없음 | ||
자동으로 구현됨
| 읽기-쓰기 | 읽기 전용의 | 쓰기 전용 | |
|---|---|---|---|
| ABAP 객체 | 해당 없음 | ||
| C++(STL) | 해당 없음 | ||
| C# | type Bar { get; set; } | type Bar { get; private set; } | type Bar { private get; set; } |
| D | 해당 없음 | ||
| 자바 | 해당 없음 | ||
| 목표-C 2.0(Cocoa) | @property (readwrite) type bar; 그 다음엔 안에 @implementation | @property (readonly) type bar; 그 다음엔 안에 @implementation | 해당 없음 |
| 스위프트 | var bar : type | let bar : type | 해당 없음 |
| 에펠 | |||
| 파이톤 | @property | @property | bar = property() |
| Visual Basic 입니다.네트 | Property Bar As type« = initial_value» (VB 10) | ||
| PHP | |||
| 펄[34] | use base qw(Class::Accessor); | use base qw(Class::Accessor); | use base qw(Class::Accessor); |
| 라쿠 | 해당 없음 | ||
| 루비 | attr_accessor :bar | attr_reader :bar | attr_writer :bar |
| Windows PowerShell | |||
| OCAML | 해당 없음 | ||
| F# | member val Bar = value with get, set | ||
| 코볼 | level-number bar clauses PROPERTY. | level-number bar clauses PROPERTY «WITH» NO SET. | level-number bar clauses PROPERTY «WITH» NO GET. |
| 코브라 | pro bar from var «as type» | get bar from var «as type» | set bar from var «as type» |
과부하 연산자
표준 연산자
| 단위의 | 이진의 | 함수 호출 | |
|---|---|---|---|
| ABAP 객체 | 해당 없음 | ||
| C++(STL) | type operator symbol () { instructions } | type operator symbol (type operand2) { instructions } | type operator () («parameters») { instructions } |
| C# | static type operator symbol(type operand) { instructions } | static type operator symbol(type operand1, type operand2) { instructions } | 해당 없음 |
| D | type opUnary(string s)() if (s == "symbol") { instructions } | type opBinary(string s)(type operand2) if (s == "symbol") { instructions } | type opCall(«parameters») { instructions } |
| 자바 | 해당 없음 | ||
| 목표-C | |||
| 스위프트 | func symbol(operand1 : type) -> returntype { instructions } (기존 클래스) | func symbol(operand1 : type1, operand2 : type2) -> returntype { instructions } (기존 클래스) | |
| 에펠[35] | op_name alias "symbol": TYPE | op_name alias "symbol" (operand: TYPE1): TYPE2 | |
| 파이톤 | def __opname__(self): | def __opname__(self, operand2): | def __call__(self«, parameters»): |
| Visual Basic 입니다.네트 | Shared Operator symbol(operand As type) As type | Shared Operator symbol(operand1 As type, operand2 As type) As type | 해당 없음 |
| 소조 | Function Operator_name(operand As type) As type | 해당 없음 | |
| PHP | [36] | function __invoke(«parameters») { instructions } (PHP 5.3+) | |
| 펄 | use overload "symbol" => sub { my ($self) = @_; instructions }; | use overload "symbol" => sub { my ($self, $operand2, $operands_reversed) = @_; instructions }; | |
| 라쿠 | «our «type »»«multi »method prefix:<symbol> («$operand: ») { instructions ... return value; } or | «our «type »»«multi »method infix:<symbol> («$operand1: » type operand2) { instructions ... return value; } | «our «type »»«multi »method postcircumfix:<( )> («$self: » «parameters») { instructions } |
| 루비 | def symbol | def symbol(operand2) | 해당 없음 |
| Windows PowerShell | 해당 없음 | ||
| OCAML | |||
| F# | static member (symbol) operand = expression | static member (symbol) (operand1, operand2) = expression | 해당 없음 |
| 코볼 | 해당 없음 | ||
| ISLISP | 해당 없음 | ||
인덱서
| 읽기-쓰기 | 읽기 전용의 | 쓰기 전용 | |
|---|---|---|---|
| ABAP 객체 | 해당 없음 | ||
| APL(Dynalog) | :Property Numbered Default name∇ result ← Getinstructions∇∇ Set argumentsinstructions∇:EndProperty Bar | :Property Numbered Default Bar∇ result ← Getinstructions∇:EndProperty Bar | :Property Numbered Default Bar∇ Set argumentsinstructions∇:EndProperty Bar |
| C++(STL) | type& operator[](type index) { instructions } | type operator[](type index) { instructions } | |
| C# | type this[type index] { | type this[type index] { get{ instructions } } | type this[type index] { set{ instructions } } |
| D | type opIndex(type index) { instructions } | type opIndex(type index) { instructions } | type opIndexAssign(type value, type index) { instructions } |
| 자바 | 해당 없음 | ||
| 목표-C(최근 클랑 컴파일러) | 해당 없음 | - (id)objectAtIndexedSubscript:(NSUInteger)index { instructions return value; } or | - (void)setObject:(id)value atIndexedSubscript:(NSUInteger)index { instructions } or |
| 스위프트 | subscript (index : type) -> returntype { get { instructions } set«(newIndex)» { instructions } } | subscript (index : type) -> returntype { instructions } | |
| 에펠[35] | bracket_name alias "[]" (index: TYPE): TYPE assign set_item | bracket_name alias "[]" (index: TYPE): TYPE | |
| 파이톤 | def __getitem__(self, index): | def __getitem__(self, index): | def __setitem__(self, index, value): |
| Visual Basic 입니다.네트 | Default Property Item(Index As type) As type | Default ReadOnly Property Item(Index As type) As type | Default WriteOnly Property Item(Index As type) As type |
| PHP | [37] | ||
| 펄 | [38] | ||
| 라쿠 | «our «type »»«multi »method postcircumfix:<[ ]> is rw («$self: » type $index) { instructions ... return value; } or | «our «type »»«multi »method postcircumfix:<[ ]>(«$self: » type $index) { instructions ... return value; } or | 해당 없음 |
| 루비 | def [](index) | def [](index) | def []=(index, value) |
| Windows PowerShell | 해당 없음 | ||
| OCAML | |||
| F# | member this.Item with get(index) = expression and set index value = expression | member this.Item with get(index) = expression | member this.Item with set index value = expression |
| 코볼 | 해당 없음 | ||
| 코브라 | pro[index «as type»] as type | get[index «as type»] as type | set[index «as type»] as type |
유형 캐스트
| 풀이 죽다 | 흐린 | |
|---|---|---|
| ABAP 객체 | 해당 없음 | |
| C++(STL) | operator returntype() { instructions } | |
| C# | static explicit operator returntype(type operand) { instructions } | static implicit operator returntype(type operand) { instructions } |
| D | T opCast(T)() if (is(T == type)) { instructions } | |
| eC | property T { get { return «conversion code»; } } | |
| 자바 | 해당 없음 | |
| 목표-C | ||
| 에펠[35] | ||
| 파이톤 | ||
| Visual Basic 입니다.네트 | Shared Narrowing Operator CType(operand As type) As returntype | Shared Widening Operator CType(operand As type) As returntype |
| PHP | 해당 없음 | |
| 펄 | ||
| 라쿠 | multi method type«($self:)» is export { instructions } | |
| 루비 | 해당 없음 | |
| Windows PowerShell | ||
| OCAML | ||
| F# | ||
| 코볼 | 해당 없음 | |
회원접속
객체 x의 멤버에 액세스하는 방법
| 목적회원 | 반원 | 네임스페이스 멤버 | |||
|---|---|---|---|---|---|
| 방법 | 밭을 갈다 | 재산 | |||
| ABAP 객체 | x->method(«parameters»).[39] | x->field | 해당 없음 | x=>field or x=>method(«parameters[39]»). | 해당 없음 |
| C++(STL) | x.method(parameters) or | x.field or | cls::member | ns::member | |
| 목표-C | [x method«:parameter «bar:parameter ...»»] | x->field | x.property (2.0 only) or | [cls method«:parameter «bar:parameter ...»»] | |
| 스몰토크 | x method«:parameter «bar:parameter ...»» | 해당 없음 | cls method«:parameter «bar:parameter ...»» | ||
| 스위프트 | x.method(parameters) | x.property | cls.member | ||
| APL(Dynalog) | left argument» x.method «right argument(s)» | x.field | x.property | cls.member | ns.member |
| C# | x.method(parameters) | ||||
| 자바 | 해당 없음 | ||||
| D | x.property | ||||
| 파이톤 | |||||
| Visual Basic 입니다.네트 | |||||
| 소조 | |||||
| Windows PowerShell | [cls]::member | ||||
| F# | 해당 없음 | cls.member | |||
| eC | x.method«(parameters)» | x.field | x.property | cls::member | ns::member |
| 에펠 | x.method«(parameters)» | x.field | {cls}.member | 해당 없음 | |
| 루비 | 해당 없음 | x.property | cls.member | ||
| PHP | x->method(parameters) | x->field | x->property | cls::member | ns\member |
| 펄 | x->method«(parameters)» | x->{field} | cls->method«(parameters)» | ns::member | |
| 라쿠 | x.method«(parameters)» or | x.field or | cls.method«(parameters)» or | ns::member | |
| OCAML | x#method «parameters» | 해당 없음 | |||
| 자바스크립트 | x.method(parameters) | x.field | x.property | cls.member | 해당 없음 |
| 코볼 | INVOKE x "method" «USING parameters» «RETURNING result» or | 해당 없음 | property OF x | INVOKE cls "method" «USING parameters» «RETURNING result» or | 해당 없음 |
| 코브라 | x.method«(parameters)» | x.field | x.property | cls.member | ns.member |
회원 가능 여부
| 멤버는? | 부재중 처리기 | |||
|---|---|---|---|---|
| 방법 | 밭 | 방법 | 밭 | |
| APL(Dynalog) | 3=x.⎕NC'method' | 2=x.⎕NC'method' | 해당 없음 | |
| ABAP 객체 | 해당 없음 | |||
| C++(STL) | ||||
| 목표-C(Cocoa) | [x respondsToSelector:@selector(method)] | 해당 없음 | forwardInvocation: | 해당 없음 |
| 스몰토크 | x respondsTo: selector | 해당 없음 | doesNotUnderstand: | 해당 없음 |
| C# | (반사 사용) | |||
| eC | ||||
| 자바 | ||||
| D | opDispatch() | |||
| 에펠 | 해당 없음 | |||
| 파이톤 | hasattr(x, "method") and callable(x.method) | hasattr(x, "field") | __getattr__() | |
| Visual Basic 입니다.네트 | (반사 사용) | |||
| 소조 | (내성 사용) | |||
| Windows PowerShell | (반사 사용) | |||
| F# | (반사 사용) | |||
| 루비 | x.respond_to?(:method) | 해당 없음 | method_missing() | 해당 없음 |
| PHP | method_exists(x, "method") | property_exists(x, "field") | __call() | __get() / __set() |
| 펄 | x->can("method") | exists x->{field} | 자동 장착 | |
| 라쿠 | x.can("method") | x.field.defined | 자동 장착 | |
| OCAML | 해당 없음 | |||
| 자바스크립트 | typeof x.method === "function" | field in x | ||
| 코볼 | 해당 없음 | |||
특수 변수
| 현재 목적어 | 현재 개체의 상위 개체 | 무효참고 | 현재 실행 컨텍스트 | |
|---|---|---|---|---|
| 스몰토크 | self | super | nil | thisContext |
| ABAP 객체 | me | super | initial | |
| APL(Dynalog) | ⎕THIS | ⎕BASE | ⎕NULL | |
| C++(STL) | *this | [40] | NULL, nullptr | |
| C# | this | base[41] | null | |
| 자바 | super[41] | |||
| D | ||||
| 자바스크립트 | super[41] (ECMAScript 6) | null, undefined[42] | ||
| eC | this | null | ||
| 목표-C | self | super[41] | nil | |
| 스위프트 | self | super[41] | nil[43] | |
| 파이톤 | self[44] | super(current_class_name, self)[5]super() (3.x에만 해당) | None | |
| Visual Basic 입니다.네트 | Me | MyBase | Nothing | |
| 소조 | Me / Self | Parent | Nil | |
| 에펠 | Current | Precursor «{superclass}» «(args)»[41][45] | Void | |
| PHP | $this | parent[41] | null | |
| 펄 | $self[44] | $self->SUPER[41] | undef | |
| 라쿠 | self | SUPER | Nil | |
| 루비 | self | super«(args)»[46] | nil | binding |
| Windows PowerShell | $this | $NULL | ||
| OCAML | self[47] | super[48] | 해당[49] 없음 | |
| F# | this | base[41] | null | |
| 코볼 | SELF | SUPER | NULL | |
| 코브라 | this | base | nil |
특수 방법
| 문자열 표현 | 객체 카피 | 가치평등 | 객체 비교 | 해시코드 | 객체 ID | ||
|---|---|---|---|---|---|---|---|
| 사람이 읽을 수 있는 | 소스 호환 | ||||||
| ABAP 객체 | 해당 없음 | ||||||
| APL(Dynalog) | ⍕x | ⎕SRC x | ⎕NS x | x = y | 해당 없음 | ||
| C++(STL) | x == y[50] | 객체에 대한 포인터를 정수 ID로 변환할 수 있음 | |||||
| C# | x.ToString() | x.Clone() | x.Equals(y) | x.CompareTo(y) | x.GetHashCode() | System | |
| 자바 | x.toString() | x.clone()[51] | x.equals(y) | x.compareTo(y)[52] | x.hashCode() | System | |
| 자바스크립트 | x.toString() | ||||||
| D | x.toString() or | x.stringof | x == y or | x.opCmp(y) | x.toHash() | ||
| eC | x.OnGetString(tempString, null, null) or | y.OnCopy(x) | x.OnCompare(y) | 객체 핸들을 정수 ID로 변환할 수 있음 | |||
| 목표-C(Cocoa) | x.description | x.debugDescription | [x copy][53] | [x isEqual:y] | [x compare:y][54] | x.hash | 객체에 대한 포인터를 정수 ID로 변환할 수 있음 |
| 스위프트 | x.description[55] | x.debugDescription[56] | x == y[57] | x < y[58] | x.hashValue[59] | reflect(x) | |
| 스몰토크 | x displayString | x printString | x copy | x = y | x hash | x identityHash | |
| 파이톤 | str(x)[60] | repr(x)[61] | copy.copy(x)[62] | x == y[63] | cmp(x, y)[64] | hash(x)[65] | id(x) |
| Visual Basic 입니다.네트 | x.ToString() | x.Clone() | x.Equals(y) | x.CompareTo(y) | x.GetHashCode() | ||
| 에펠 | x.out | x.twin | x.is_equal(y) | x가 있는 경우 COMPARABLE, 간단히 할 수 있다. x < y | x가 있는 경우 HASHABLE, 사용할 수 있다. x.hash_code | x가 있는 경우 IDENTIFIED, 사용할 수 있다. x.object_id | |
| PHP | $x->__toString() | clone x[66] | x == y | | spl_object_hash(x) | ||
| 펄 | "$x"[67] | Data::Dumper[68] | Storable[69] | Scalar[70] | |||
| 라쿠 | ~x[67] | x.perl | x.clone | x eqv y | x cmp y | x.WHICH | |
| 루비 | x.to_s | x.inspect | x.dup or | x == y or | x <=> y | x.hash | x.object_id |
| Windows PowerShell | x.ToString() | x.Clone() | x.Equals(y) | x.CompareTo(y) | x.GetHashCode() | ||
| OCAML | Oo.copy x | x = y | Hashtbl | Oo.id x | |||
| F# | string x or x | sprintf "%A" x | x.Clone() | x = y or x | compare x y or x | hash x or x | |
| 코볼 | 해당 없음 | ||||||
유형조작
| 개체 유형 가져오기 | 의 인스턴스(하위 유형 포함) | 업캐스팅 | 다운캐스팅 | ||
|---|---|---|---|---|---|
| 런타임 조회 | 수표 없음 | ||||
| ABAP 객체 | 해당[71] 없음 | = | ?= | ||
| C++(STL) | typeid(x) | dynamic_cast<type *>(&x) != nullptr | 해당[72] 없음 | dynamic_cast<type*>(ptr) | (type*) ptr or |
| C# | x.GetType() | x is type | (type) x or x as type | ||
| D | typeid(x) | cast(type) x | |||
| 델파이 | x is type | x as type | |||
| eC | x._class | eClass_IsDerived(x._class, type) | (type) x | ||
| 자바 | x.getClass() | x instanceof class | (type) x | ||
| 목표-C(Cocoa) | [x class][73] | [x isKindOfClass:[class class]] | (type*) x | ||
| 스위프트 | x.dynamicType | x is type | x as! type x as? type | ||
| 자바스크립트 | x.constructor (If not rewritten.) | x instanceof class | 해당[74] 없음 | ||
| Visual Basic 입니다.네트 | x.GetType() | TypeOf x Is type | 해당[72] 없음 | CType(x, type) or TryCast(x, type) | |
| 소조 | Introspection.GetType(x) | x IsA type | 해당 없음 | CType(x, type) | 해당 없음 |
| 에펠 | x.generating_type | attached {TYPE} x | attached {TYPE} x as down_x | ||
| 파이톤 | type(x) | isinstance(x, type) | 해당[74] 없음 | ||
| PHP | get_class(x) | x instanceof class | |||
| 펄 | ref(x) | x->isa("class") | |||
| 라쿠 | x.WHAT | x.isa(class) | 해당[72] 없음 | type(x) or | |
| 루비 | x.class | x.instance_of?(type) or | 해당[74] 없음 | ||
| 스몰토크 | x class | x isKindOf: class | |||
| Windows PowerShell | x.GetType() | x -is [type] | 해당[72] 없음 | [type]x or x -as [type] | |
| OCAML | 해당[75] 없음 | (x :> type) | 해당 없음 | ||
| F# | x.GetType() | x :? type | (x :?> type) | ||
| 코볼 | 해당 없음 | x AS type[72] | 해당 없음 | ||
네임스페이스 관리
| 네임스페이스 가져오기 | 수입품목 | ||
|---|---|---|---|
| 자격이 있는 | 자격이 없는 | ||
| ABAP 객체 | |||
| C++(STL) | using namespace ns; | using ns::item ; | |
| C# | using ns; | using item = ns.item; | |
| D | import ns; | import ns : item; | |
| 자바 | import ns.*; | import ns.item; | |
| 목표-C | |||
| Visual Basic 입니다.네트 | Imports ns | ||
| 에펠 | |||
| 파이톤 | import ns | from ns import * | from ns import item |
| PHP | use ns; | use ns\item; | |
| 펄 | use ns; | use ns qw(item); | |
| 라쿠 | |||
| 루비 | |||
| Windows PowerShell | |||
| OCAML | open ns | ||
| F# | |||
| 코볼 | 해당 없음 | ||
계약
| 전제조건 | 사후 조건 | 수표 | 불변성 | 루프 | |
|---|---|---|---|---|---|
| ABAP 객체 | 해당 없음 | ||||
| C++(STL) | |||||
| C# | Spec#: | Spec#: | |||
| 자바 | 해당 없음 | ||||
| 목표-C | |||||
| Visual Basic 입니다.네트 | |||||
| D | f | f | assert(expression) | invariant() { expression } | |
| 에펠 | f | f | f | class X | from instructions |
| 파이톤 | 해당 없음 | ||||
| PHP | |||||
| 펄 | |||||
| 라쿠 | PRE { condition } | POST { condition } | |||
| 루비 | 해당 없음 | ||||
| Windows PowerShell | |||||
| OCAML | |||||
| F# | |||||
| 코볼 | |||||
참고 항목
참조 및 참고 사항
- ^ 매개 변수 = 생성자가 여러 매개 변수를 가진 경우 인수를 반복할 수 있음
- ^ SAP는 스스로 폐기 사용을 유보함
- ^ a b c d e f g h i j k l 이 언어는 사용되지 않은 메모리를 방출하기 위해 가비지 수집을 사용한다.
- ^ OCaml 객체는 클래스를 거치지 않고도 직접 만들 수 있다.
- ^ a b c d e f g 이 언어는 다중 상속을 지원한다. 클래스는 둘 이상의 부모 클래스를 가질 수 있다.
- ^ 부모 클래스를 제공하지 않으면 클래스가 루트 클래스가 된다. 실제로, 이것은 거의 결코 끝나지 않는다. 일반적으로 사용하고 있는 프레임워크의 일반적인 기본 클래스를 사용해야 한다.
NSObject코코아 및 GNUstep용 또는Object그렇지 않으면 - ^ 보통은
@interface부분은 헤더 파일에 배치되고@interface부분은 별도의 소스 코드 파일에 저장된다. - ^ 일반적으로 네임스페이스의 일종으로 사용되는 클래스 및 프로토콜 이름의 접두사
- ^ Python 인터페이스는 메서드가 본문으로 전달된 클래스다.
- ^ 클래스는 오브젝트.
superclass(st-80) 또는 대상 네임스페이스(Visualworks)로 메시지를 보내십시오. - ^ 네임스페이스는 개체 입니다.
상위 네임스페이스로 메시지를 보내십시오. - ^ 최종 결정자는 어떤 물체가 쓰레기 수거를 앞두고 있을 때 쓰레기 수거업자에 의해 호출된다. 언제 부르게 될지, 아예 부르게 될지 장담할 수 없다.
- ^ ABAP에서 생성자를 방법(방법에 대한 주석 참조)처럼 정의해야 하며, 방법 이름은 "구성자"여야 하며, "가져오기" 매개변수만 정의할 수 있다.
- ^ 멤버 개체 및 상위 클래스에 대한 선택적 쉼표로 구분된 이니셜라이저 목록이 여기에 표시됨. 멤버 개체를 초기화하는 구문은
"member_name(parameters)"
"class_name(parameters)".
- ^ 모든 에펠 절차는 생성 절차로 사용될 수 있다, 소위 생성자라고 불린다. Constructor(컴퓨터 과학)에서 에펠 단락을 참조하십시오.
- ^ {DISPOSable}dispose를 구현하면 객체가 가비지 수집될 때 처리가 호출될 수 있다.
- ^ 이 "초기화기" 구조는 거의 사용되지 않는다. OCaml의 필드는 일반적으로 선언에서 직접 초기화된다. 추가 명령 연산이 필요할 때만 "초기화기"를 사용한다. 다른 언어의 "시공자에 대한 매개변수"는 OCaml의 클래스에 대한 매개변수로 대신 지정된다. 자세한 내용은 클래스 선언 구문을 참조하십시오.
- ^ 이 구문은 일반적으로 생성자를 오버로드하는 데 사용된다.
- ^ 자바스크립트에서 생성자는 객체다.
- ^ 시공자는 클래스 인스턴스를 반환하는 공장 방법으로 에뮬레이션할 수 있다.
- ^ a b c 범위 식별자는 다른 범위 식별자 또는 클래스 선언의 끝에 도달할 때까지 이 범위 식별자가 범위를 가진 후 모든 변수 선언에 한 번 표시되어야 한다.
- ^ ABAP에서는 특정 분야나 방법이 외부 사물에 의해 접근 가능한 것으로 선언되지 않는다. 오히려 외부 수업은 수업의 분야나 방법에 접근할 수 있는 친구로 선언된다.
- ^ C++에서는 특정 분야가 외부 사물에 의해 접근 가능한 것으로 선언되지 않는다. 오히려 외부 기능과 수업은 수업의 분야에 접근할 수 있는 친구로 선언된다. 자세한 내용은 친구 기능 및 친구 클래스를 참조하십시오.
- ^ 그냥 수업 시간에 메시지를 보내세요.
계급 addInstVarName: 밭을 갈다. 계급 RemoveInstVarName: 밭을 갈다.
- ^ a b c d 메소드로 값을 할당하십시오.
- ^ Python은 개인 필드가 없다 - 모든 필드는 항상 공개적으로 접근할 수 있다. 구현 세부사항에 하나의 밑줄로 접두사를 붙이는 커뮤니티 규약이 존재하지만, 이는 언어에 의해 강제되지 않는다.
- ^ 모든 클래스 데이터는 COBOL 표준이 그것에 접근하는 어떤 방법도 명시하지 않기 때문에 '개인 데이터'이다.
- ^ ABAP에서의 방법의 선언과 실행은 별개다. methods statement는 클래스 정의 내에서 사용된다. 방법("s" 미포함)은 클래스 구현 내에서 사용된다. 매개 변수 = 여러 매개 변수가 있을 경우 인수를 반복할 수 있다.
- ^ ABAP에서 반환 매개 변수 이름은 클래스 정의 내의 메서드 서명에 명시적으로 정의된다.
- ^ C++에서는 일반적으로 선언 방법과 실행 방법은 별개다. 구문을 사용하여 클래스 정의(일반적으로 헤더 파일에 포함됨)에 메서드가 선언됨
- ^ 어떤 방법의 본문은 여기 표와 같이 계급 정의 내부의 선언과 함께 포함될 수 있지만, 이것은 일반적으로 나쁜 관행이다. 클래스 정의는 클래스의 필드나 메서드를 사용하는 모든 소스 파일에 포함되어야 하기 때문에 클래스 정의에 코드가 있으면 모든 소스 파일과 함께 메서드 코드를 컴파일하여 코드의 크기를 증가시킨다. 그러나, 어떤 상황에서는, 방법의 본문을 선언문에 포함시키는 것이 유용하다. 한 가지 이유는 컴파일러가 클래스 선언에 포함된 인라인 방식을 시도할 것이기 때문에 매우 짧은 한 줄의 방법이 발생할 경우 선언서와 함께 본체를 포함시킴으로써 컴파일러가 인라인 작업을 할 수 있도록 하는 것이 더 빨라질 수 있기 때문이다. 또한, 템플릿 클래스나 메서드가 발생하는 경우, 코드로만 템플릿을 인스턴스화할 수 있기 때문에 모든 코드가 선언문에 포함되어야 한다.
- ^ a b 메소드로 함수를 할당하십시오.
- ^ 대체 구현:
반항하다 술집을 내다(): 의사 선생님 = "바 속성." 반항하다 똥을 싸다(자아의): 돌아오다 자아의._bar 반항하다 틀에 박다(자아의, 가치를 매기다): 자아의._bar = 가치를 매기다 돌아오다 현지인() 술집을 내다 = 재산(**술집을 내다())
- ^ 이 예에는 다음 등급이 필요하다.액세스기 모듈이 장착됨
- ^ a b c 에펠은 연산자의 과부하를 지원하지 않지만 연산자를 정의할 수 있다.
- ^ PHP는 기본적으로 운영자 과부하를 지원하지 않지만, "운영자" PECL 패키지를 사용하여 지원을 추가할 수 있다.
- ^ 클래스는 ArrayAccess 인터페이스를 구현해야 한다.
- ^ 클래스는 '@{}'(어레이 참조 해제) 또는 Tie의 하위 클래스 중 하나를 오버로드해야 한다.배열 또는 타이::배열 작업을 후크하기 위한 StdArray
- ^ a b ABAP에서는 다음과 같은 구문을 사용하여 인수를 전달해야 한다.
x->method(«exporting parameter = argument» «importing parameter = argument» «changing parameter = argument» «returning value(parameter)»parameter = argument여러 개의 매개 변수가 있을 경우 반복할 수 있음
- ^ C++는 다중 상속이 가능하기 때문에 어떤 기본 클래스를 참조하는지가 모호할 수 있기 때문에 "슈퍼" 키워드가 없다. 대신, The는
BaseClassName::member구문은 지정된 기본 클래스의 재정의된 멤버에 액세스하는 데 사용될 수 있다. Microsoft Visual C++는 이를 위해 비표준 키워드 "_super"를 제공하지만 다른 컴파일러에서는 지원되지 않는다.[1] - ^ a b c d e f g h i 여기서 키워드는 값이 아니며, 슈퍼클래스의 메서드에 접근할 때만 사용할 수 있다.
- ^ 그러나 두려워하라, 그들은 같은 가치를 가지고 있지 않다.
- ^ 선택적 유형에만 해당
- ^ a b 이 언어에서 인스턴스(instance) 방법은 관례적으로 "self"라고 이름 붙여진 첫 번째 매개 변수로 현재 개체를 통과하지만, 이 경우에는 필요하지 않다.
- ^ 에펠의 '프리커서'는 사실 슈퍼클래스의 동명 방식에 대한 호출이다. 그래서 전구체(args)는 자바어로 "super.currentMethodName(args)"에 해당한다. 슈퍼클래스에서는 이름이 다른 방법을 부를 방법이 없다.
- ^ 루비의 "슈퍼"는 다른 언어와 달리 사실 슈퍼클래스에서 같은 이름의 방법에 대한 호출이다. 그래서 루비의 super(args)는 자바의 super.currentMethodName(args)에 해당한다. 슈퍼클래스에서는 이름이 다른 방법을 부를 방법이 없다.
- ^ OCaml에서 객체 선언은 선택적으로 현재 객체와 연관될 매개변수로 시작할 수 있다. 이 매개변수는 통상적으로 "self"라고 명명되지만, 반드시 그럴 필요는 없다. 거기에 매개 변수를 두어 자기 방식대로 부를 수 있도록 하는 것이 좋은 습관이다.
- ^ OCaml에서 상속 선언("상속")은 선택적으로 값과 연관될 수 있으며, "상속 parent_class «parameters » as super" 구문은 다음과 같다. 여기서 "super"는 이 상위 객체와 연관된 변수에 주어진 이름이다. 그것은 다르게 이름 지어질 수 있다.
- ^ 단, OCaml에서 "선택적" 값을 가질 수 있는 기능이 필요한 경우, 값을 한 개 안에 넣으십시오.
option유형, 값None그리고Some x다른 언어에서와 같이 "객체 참조" 및 "객체에 대한 비사용 참조"를 나타내기 위해 사용될 수 있다. - ^ "x"와 "y"가 (점자가 아니라) 물체라고 가정한다. 개체 오버로드로 사용자 지정할 수 있음
==교환원의 - ^ 다음 이후 클래스 내에서만 액세스할 수 있음
clone()에서 물려받은 방법Object클래스가 메소드를 무시하고 공개하지 않는 한 보호된다. 만약 사용한다면clone()에서 물려받은.Object, 클래스는 다음을 실행해야 한다.Cloneable복제를 허용하는 인터페이스. - ^ 클래스는 인터페이스를 구현해야 한다.
Comparable이 방법을 표준화해야 한다. - ^ 개체에서 구현
copyWithZone:방법 - ^
compare:Foundation 클래스의 비교 방법의 일반적인 이름이다. 그러나 공식적인 프로토콜은 존재하지 않는다. - ^ 물체가 에 부합하는 경우에만
Printable의정서 - ^ 물체가 에 부합하는 경우에만
DebugPrintable의정서 - ^ 물체가 에 부합하는 경우에만
Equatable의정서 - ^ 물체가 에 부합하는 경우에만
Comparable의정서 - ^ 물체가 에 부합하는 경우에만
hashValue의정서 - ^ 개체별로 사용자 지정할 수 있음
__str__()방법 - ^ 개체별로 사용자 지정할 수 있음
__repr__()방법 - ^ 개체별로 사용자 지정할 수 있음
__copy__()방법 - ^ 개체별로 사용자 지정할 수 있음
__eq__()방법 - ^ Python 2.x 및 이전 버전에서만 사용(Python 3.0에서 제거됨). 개체별로 사용자 지정할 수 있음
__cmp__()방법 - ^ 개체별로 사용자 지정할 수 있음
__hash__()방법 모든 유형이 해시 가능한 것은 아님(해시 가능한 유형은 일반적으로 해시가 가능하지 않음) - ^ 개체별로 사용자 지정할 수 있음
__clone()방법 - ^ a b 개체의 문자열 변환 연산자를 오버로드하여 사용자 지정할 수 있음
- ^ 이 예에서는 데이터::덤퍼
- ^ 이 예에서는 Storable을 사용해야 함
- ^ 이 예에서는 Scalar를 사용해야 한다.:Util
- ^ ABAP의 런타임 유형 정보는 CL_ABAP_CLASSDESCR과 같은 다른 설명을 사용하여 수집할 수 있다.
- ^ a b c d e 이 언어에는 업캐스트가 내포되어 있다. 슈퍼타입이 필요한 경우 서브타입 인스턴스를 사용할 수 있다.
- ^ 등급이 아닌 객체에 한함. 만약
x계급의 대상이다.[x class]반품만 하다x. 런타임 방법object_getClass(x)의 반을 돌려줄 것이다x모든 목적을 위해 - ^ a b c 이 언어는 동적으로 타이핑된다. 유형 간 주조는 불필요하다.
- ^ 이 언어는 런타임 타입의 정보를 제공하지 않는다. 정적으로 타자를 치고 다운캐스팅이 불가능하기 때문에 불필요하다.