This comparison of programming languages compares how object-oriented programming languages such as C++, Java, Smalltalk, Object Pascal, Perl, Python, and others manipulate data structures.
data variable type ref to class .create object variable «exporting parameter = argument».
variable←⎕NEW class «parameters»
⎕EX 'variable'
class variable«(parameters)»;
class *variable = new class«(parameters)»;
delete pointer;
class variable = new class(parameters);
variable.Dispose();
destroy(variable);
class «instance handle» { «properties/data members assignments, instance method overrides» }
delete instance handle;
class *variable = [[class alloc ] init];
class *variable = [[class alloc ] initWithFoo:parameter «bar:parameter ...»];
[variable release];
let variable = class(parameters)
variable = class(parameters)
del variable
Dim variable As New class(parameters)
variable.Dispose()
variable = Nil
create variable
create «{TYPE}» variable.make_foo «(parameters)»
variable := create {TYPE}
variable := create {TYPE}.make_foo «(parameters)»
$variable = new class«(parameters)»;
unset($variable);
«my »$variable = class->new«(parameters)»;
undef($variable);
«my »$variable = class.new«(parameters)»;
$variable.undefine;
variable = class.new«(parameters)»
$variable = New-Object «-TypeName» class ««-ArgumentList» parameters»
Remove-Variable «-Name» variable
let variable = new class «parameters»
let variable = object members end
let variable = «new »class(«parameters»)
#new
#new:
Point x: 10 y: 20. Array with: -1 with: 3 with: 2.
var variable = new class«(parameters)»
var variable = { «key1: value1«, key2: value2 ...»»}
ClassVar := ClassType.ConstructorName(parameters);
ClassVar.Free;
val obj = new Object // no parameters val obj = new Object(arg0, arg1, arg2...) val obj = Object(arg0, arg1, arg2...) // case class val obj = new Object(arg0, arg1, param1 = value1, ...) // named parameters
INVOKE class "NEW" RETURNING variable
MOVE class::"NEW" TO variable
variable «as class» = class(parameters)
variable.dispose
(setq variable (create (class <some-class> [:field-1 value-1 [:field-2 value-2] ..])))
class name definition «inheriting from parentclass». «interfaces: interfaces.» method_and_field_declarations endclass.class name implementation. method_implementations endclass.
interface name. members endinterface.
:Class name «:parentclass» «,interfaces»
members
:EndClass
:Interface name
:EndInterface
:Namespace name
:EndNamespace
class name« : public parentclasses
» { members };
namespace name { members }
class name« : «parentclass»«, interfaces»» { members }
interface name« : parentinterfaces» { members }
module name; members
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
namespace name; members
@interface name« : parentclass»
«< protocols >» { instance_fields } method_and_property_declarations @end @implementation name method_implementations @end
@protocol name«< parentprotocols >» members @end
class name« : «parentclass»«, protocols»» { members }
protocol name« : parentprotocols» { members }
class name«(parentclasses[7])»:Tab ↹ members
__all__ = [ member1,member2,... ]
Class name« Inherits parentclass»« Implements interfaces»members End Class
Interface name« Inherits parentinterfaces»members End Interface
Namespace namemembers End Namespace
Module namemembers End Module
class name« inherit parentclasses[7]»membersend
package name; «@ISA = qw(parentclasses[7]);» members 1;
class name «is parentclass «is parentclass ...[7]»» «does role «does role ...»» { members }
role name «does role «does role ...»» { members }
module name { members }
class name« < parentclass» members end
module name members end
class name «parameters» = object «(self)» «inherit parentclass «parameters» «inherit parentclass «parameters» ...[7]»» members end
module name members
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 members
class
name «extends parentclass» { members }
ClassName = Class «(ClassParent, Interfaces)» private // Private members(include Methods and Fields) public // Public members protected // Protected members published // Published members end;
class ConcreteClass(constructor params) extends ParentClass with Trait1 with Trait2 with Trait2 { // members }
trait TraitName extends OtherTrait1 with OtherTrait2 with OtherTrait3 { // members }
package name
CLASS-ID. name« INHERITS« FROM» parentclasses».
FACTORY« IMPLEMENTS interfaces».
class-members
END FACTORY.
OBJECT« IMPLEMENTS interfaces».
instance-members
END OBJECT.
END CLASS name.
INTERFACE-ID. name« INHERITS« FROM» interfaces».
END INTERFACE name.
class name «inherits parentclass» «implements interfaces»Tab ↹ members
interface name «inherits parentinterfaces»Tab ↹ members
namespace nameTab ↹ members
(defclass name (base-class) ((x :initform 0 :accessor get-x :initarg x)) (:abstractp nil))
methods constructor «importing parameter = argument»method constructor. instructions endmethod.
∇ name
:Implements Constructor «:Base «expr»»
instructions
∇
:Implements Destructor
class(«parameters») «: initializers
» { instructions }
~class() { instructions }
class(«parameters») { instructions }
void Dispose(){ instructions }
this(«parameters») { instructions }
~this() { instructions }
class() { instructions }
void finalize() { instructions }
- (id)init { instructions... return self; } or - (id)initWithFoo:parameter «bar:parameter ...» { instructions... return self; }
- (void)dealloc { instructions }
- (void)finalize { instructions }
init(«parameters») { instructions }
deinit { instructions }
def __init__(self«, parameters»): Tab ↹ instructions
def __del__(self): Tab ↹ instructions
Sub New(«parameters») instructions End Sub
Sub Dispose() instructions End Sub
Overrides Sub Finalize() instructions End Sub
Sub Constructor(«parameters») instructions End Sub
Sub Destructor() instructions End Sub
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 «multi » method new(««$self: »parameters») { self.bless(*, field1 => value1, ...); ... instructions }
submethod DESTROY { instructions }
def initialize«(parameters)» instructions end
initializer instructions
do instructions or new(parameters) = expression
member this.Dispose() = instructions
override this.Finalize() = instructions
function name(«parameters») { instructions }
constructor(
«parameters») { instructions }
cue init(parameters)Tab ↹ base.initTab ↹ instructions
def disposeTab ↹ instructions
(defmethod initialize-object ((instance <class-name>) initvalues)
public section.[23] data field type type.
private section.[23] data field type type.
protected section.[23] data field type type.
:Field Public field «← value»
:Field «Private» field «← value»
public: type field;
private: type field;
protected: type field;
public type field «= value»;
private type field «= value»;
protected type field «= value»;
internal type field «= value»;
package type field «= value»;
type field «= value»;
public type field;
private type field;
feature field: TYPE
feature {NONE} field: TYPE
feature {current_class} field: TYPE
feature {FRIEND} field: TYPE
@public type field;
@private type field;
@protected type field;
@package type field;
self.field = value
Public field As type «= value»
Private field As type «= value»
Protected field As type «= value»
Friend field As type «= value»
public $field «= value»;
private $field «= value»;
protected $field «= value»;
$self->{field} = value;
has« type »$.field« is rw»
has« type »$!field
@field = value
Add-Member «-MemberType »NoteProperty «-Name »Bar «-Value »value-InputObject variable
val «mutable» field = value
let «mutable» field = value
this.field = value this["field"] = value
var field «as type» «= value»
var __field «as type» «= value»
var _field «as type» «= value»
(field :initform value :accessor accessor-name :initarg keyword)
methods name «importing parameter = argument» «exporting parameter = argument» «changing parameter = argument» «returning value(parameter)»method name. instructions endmethod.
∇ «left argument» name «right arguments»
∇ result ← «left argument» name «right arguments»
type foo(«parameters»);
The implementation of methods is usually provided in a separate source file, with the following syntax
type class::foo(«parameters») { instructions }
void foo(«parameters») { instructions }
type foo(«parameters») { instructions ... return value; }
void ««type of 'this'»::»foo(«parameters») { instructions }
type ««type of this»::»foo(«parameters») { instructions ... return value; }
foo ( «parameters» ) do instructions end
foo ( «parameters» ): TYPE do instructions... Result := value end
- (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»): Tab ↹ instructions
def foo(self«, parameters»): Tab ↹ instructions Tab ↹ return value
Sub Foo(«parameters») instructions End Sub
Function Foo(«parameters») As type instructions ... Return value End Function
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)» instructions end
def foo«(parameters)» instructions expression resulting in return value end or def foo«(parameters)» instructions return value end
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
method foo «parameters» = expression
member this.foo(«parameters») = expression
this.method = function(«parameters») {instructions} name«.prototype.method = function(«parameters») {instructions}
this.method = function(«parameters») {instructions... return value;} name«.prototype.method = function(«parameters») {instructions... return value;}
foo(«parameters») {instructions}
foo(«parameters») {instructions... return value;}
METHOD-ID. foo.«DATA DIVISION.LINKAGE SECTION.parameter declarations»PROCEDURE DIVISION« USING parameters».
END METHOD foo.
METHOD-ID. foo.DATA DIVISION.LINKAGE SECTION.«parameter declarations»result-var declarationPROCEDURE DIVISION« USING parameters» RETURNING result-var.
def foo(parameters)Tab ↹ instructions
def foo(parameters) as typeTab ↹ instructionsTab ↹ return value
(defgeneric method (arg1 arg2))(defmethod method ((arg1 <class1> arg2 <class2>) ...)
How to declare a property named "Bar"
:Property Bar
∇ result ← Get
∇ Set arguments
:EndProperty Bar
type Bar { get { instructions ... return value; } set { instructions } }
type Bar { get { instructions ... return value; } }
type Bar { set { instructions } }
@property type bar() { instructions ... return value; } @property type bar(type value) { instructions ... return value; }
@property type bar() { instructions ... return value; }
@property type bar(type value) { instructions ... return value; }
property type Bar { get { instructions ... return value; } set { instructions } }
property type Bar { get { instructions ... return value; } }
property type Bar { set { instructions } }
@property (readwrite) type bar;
@implementation - (type)bar { instructions } - (void)setBar:(type)value { instructions }
@property (readonly) type bar;
@implementation - (type)bar { instructions }
var bar : type { get { instructions } set«(newBar)» { instructions } }
var bar : type { instructions }
feature -- Access x: TYPE assign set_x feature -- Settings set_x (a_x: like x) do instructions ensure x_set: verification end
def setBar(self, value): Tab ↹ instructionsdef getBar(self):Tab ↹ instructionsTab ↹ return valuebar = property(getBar, setBar)
def getBar(self): Tab ↹ instructionsTab ↹ return valuebar = property(getBar)
def setBar(self, value): Tab ↹ instructionsbar = property(fset = setBar)
Property Bar() As typeGetinstructionsReturn valueEnd GetSet (ByVal Value As type)instructionsEnd SetEnd Property
ReadOnly Property Bar() As typeGetinstructionsReturn valueEnd GetEnd Property
WriteOnly Property Bar() As typeSet (ByVal Value As type)instructionsEnd SetEnd Property
ComputedProperty Bar() As typeGetinstructionsReturn valueEnd GetSet (ByVal Value As type)instructionsEnd SetEnd ComputedProperty
ComputedProperty Bar() As typeGetinstructionsReturn valueEnd GetEnd ComputedProperty
ComputedProperty Bar() As typeSet (value As type)instructionsEnd SetEnd ComputedProperty
function __get($property) { switch ($property) { case 'Bar' : instructions ... return value; } }function __set($property, $value) { switch ($property) { case 'Bar' : instructions } }
function __get($property) { switch ($property) { case 'Bar' : instructions ... return value; } }
function __set($property, $value) { switch ($property) { case 'Bar' : instructions } }
sub Bar { my $self = shift; if (my $Bar = shift) { # setter $self->{Bar} = $Bar; return $self; } else { # getter return $self->{Bar}; }}
sub Bar { my $self = shift; if (my $Bar = shift) { # read-only die "Bar is read-only\n"; } else { # getter return $self->{Bar}; }}
sub Bar { my $self = shift; if (my $Bar = shift) { # setter $self->{Bar} = $Bar; return $self; } else { # write-only die "Bar is write-only\n"; }}
def bar instructions expression resulting in return value end def bar=(value) instructions end
def bar instructions expression resulting in return value end
def bar=(value) instructions end
Add-Member «-MemberType »ScriptProperty «-Name »Bar «-Value »{ instructions ... return value } «-SecondValue »{ instructions } -InputObject variable
Add-Member «-MemberType »ScriptProperty «-Name »Bar «-Value »{ instructions ... return value} -InputObject variable
Add-Member «-MemberType »ScriptProperty «-Name »Bar -SecondValue { instructions } -InputObject variable
member this.Bar with get() = expression and set(value) = expression
member this.Bar = expression
member this.Bar with set(value) = expression
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.DATA DIVISION.LINKAGE SECTION.return-var declarationPROCEDURE DIVISION RETURNING return-var.
END METHOD.METHOD-ID. SET PROPERTY bar.DATA DIVISION.LINKAGE SECTION.value-var declarationPROCEDURE DIVISION USING value-var.
END METHOD.
METHOD-ID. SET PROPERTY bar.DATA DIVISION.LINKAGE SECTION.value-var declarationPROCEDURE DIVISION USING value-var.
pro bar «as type»Tab ↹ getTab ↹Tab ↹ instructionsTab ↹Tab ↹ return valueTab ↹ setTab ↹Tab ↹ instructions
get bar «as type»Tab ↹ instructionsTab ↹ return value
set bar «as type»Tab ↹ instructions
type Bar { get; set; }
type Bar { get; private set; }
type Bar { private get; set; }
@implementation @synthesize bar;
var bar : type
let bar : type
@propertydef bar(self):Tab ↹instructions@bar.setterdef bar(self, value):Tab ↹instructions
@propertydef bar(self):Tab ↹instructions
bar = property()@bar.setterdef bar(self, value):Tab ↹instructions
Property Bar As type« = initial_value» (VB 10)
use base qw(Class::Accessor);__PACKAGE__->mk_accessors('Bar');
use base qw(Class::Accessor);__PACKAGE__->mk_ro_accessors('Bar');
use base qw(Class::Accessor);__PACKAGE__->mk_wo_accessors('Bar');
attr_accessor :bar
attr_reader :bar
attr_writer :bar
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»
type operator symbol () { instructions }
type operator symbol (type operand2) { instructions }
type operator () («parameters») { instructions }
static type operator symbol(type operand) { instructions }
static type operator symbol(type operand1, type operand2) { instructions }
type opUnary(string s)() if (s == "symbol") { instructions }
type opBinary(string s)(type operand2) if (s == "symbol") { instructions } type opBinaryRight(string s)(type operand1) if (s == "symbol") switch (s) { instructions }
type opCall(«parameters») { instructions }
func symbol(operand1 : type) -> returntype { instructions }
func symbol(operand1 : type1, operand2 : type2) -> returntype { instructions }
op_name alias "symbol": TYPE do instructions end
op_name alias "symbol" (operand: TYPE1): TYPE2 do instructions end
def __opname__(self): Tab ↹ instructions Tab ↹ return value
def __opname__(self, operand2): Tab ↹ instructions Tab ↹ return value
def __call__(self«, parameters»): Tab ↹ instructions Tab ↹ return value
Shared Operator symbol(operand As type) As type instructions End Operator
Shared Operator symbol(operand1 As type, operand2 As type) As type instructions End Operator
Function Operator_name(operand As type) As type instructions End Function
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 postfix:<symbol> («$operand: ») { instructions ... return value; } or «our «type »»«multi »method circumfix:<symbol1 symbol2> («$operand: ») { instructions ... return value; }
«our «type »»«multi »method infix:<symbol> («$operand1: » type operand2) { instructions ... return value; }
«our «type »»«multi »method postcircumfix:<( )> («$self: » «parameters») { instructions }
def symbol instructions expression resulting in return value end
def symbol(operand2) instructions expression resulting in return value end
static member (symbol) operand = expression
static member (symbol) (operand1, operand2) = expression
:Property Numbered Default name
:Property Numbered Default Bar
type& operator[](type index) { instructions }
type operator[](type index) { instructions }
type this[type index] { get{ instructions } set{ instructions } }
type this[type index] { get{ instructions } }
type this[type index] { set{ instructions } }
type opIndex(type index) { instructions } type opIndexAssign(type value, type index) { instructions }
type opIndex(type index) { instructions }
type opIndexAssign(type value, type index) { instructions }
- (id)objectAtIndexedSubscript:(NSUInteger)index { instructions return value; } or- (id)objectForKeyedSubscript:(id)index { instructions return value; }
- (void)setObject:(id)value atIndexedSubscript:(NSUInteger)index { instructions } or- (void)setObject:(id)value forKeyedSubscript:(id)index { instructions }
subscript (index : type) -> returntype { get { instructions } set«(newIndex)» { instructions } }
subscript (index : type) -> returntype { instructions }
bracket_name alias "[]" (index: TYPE): TYPE assign set_item do instructions end set_item (value: TYPE; index: TYPE): do instructions end
bracket_name alias "[]" (index: TYPE): TYPE do instructions end
def __getitem__(self, index): Tab ↹ instructions Tab ↹ return value def __setitem__(self, index, value): Tab ↹ instructions
def __getitem__(self, index): Tab ↹ instructions Tab ↹ return value
def __setitem__(self, index, value): Tab ↹ instructions
Default Property Item(Index As type) As type Get instructions End Get Set(ByVal Value As type) instructions End Set End Property
Default ReadOnly Property Item(Index As type) As type Get instructions End Get End Property
Default WriteOnly Property Item(Index As type) As type Set(ByVal Value As type) instructions End Set End Property
«our «type »»«multi »method postcircumfix:<[ ]> is rw («$self: » type $index) { instructions ... return value; } or «our «type »»«multi »method postcircumfix:<{ }> is rw («$self: » type $key) { instructions ... return value; }
«our «type »»«multi »method postcircumfix:<[ ]>(«$self: » type $index) { instructions ... return value; } or «our «type »»«multi »method postcircumfix:<{ }> («$self: » type $key) { instructions ... return value; }
def [](index) instructions expression resulting in return value end def []=(index, value) instructions end
def [](index) instructions expression resulting in return value end
def []=(index, value) instructions end
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 typeTab ↹ getTab ↹Tab ↹ instructionsTab ↹Tab ↹ return valueTab ↹ setTab ↹Tab ↹ instructions
get[index «as type»] as typeTab ↹ instructionsTab ↹ return value
set[index «as type»] as typeTab ↹ instructions
operator returntype() { instructions }
static explicit operator returntype(type operand) { instructions }
static implicit operator returntype(type operand) { instructions }
T opCast(T)() if (is(T == type)) { instructions }
property T { get { return «conversion code»; } }
Shared Narrowing Operator CType(operand As type) As returntype instructions End Operator
Shared Widening Operator CType(operand As type) As returntype instructions End Operator
multi method type«($self:)» is export { instructions }
How to access members of an object x
x->method(«parameters»).
x->field
x=>field or x=>method(«parameters[41]»).
x.method(parameters) orptr->method(parameters)
x.field orptr->field
cls::member
ns::member
[x method«:parameter «bar:parameter ...»»]
x.property (2.0 only) or[x property]
[cls method«:parameter «bar:parameter ...»»]
x method«:parameter «bar:parameter ...»»
cls method«:parameter «bar:parameter ...»»
x.method(parameters)
x.property
cls.member
left argument» x.method «right argument(s)»
x.field
ns.member
[cls]::member
x.method«(parameters)»
{cls}.member
x->method(parameters)
x->property
ns\member
x->method«(parameters)»
x->{field}
cls->method«(parameters)»
x.method«(parameters)» or x!method«(parameters)»
x.field or x!field
cls.method«(parameters)» or cls!method«(parameters)»
x#method «parameters»
x.method(parameters)x["method"](parameters)
x.fieldx["field"]
x.propertyx["property"]
cls.membercls["member"]
INVOKE x "method" «USING parameters» «RETURNING result» orx::"method"«(«parameters»)»
property OF x
INVOKE cls "method" «USING parameters» «RETURNING result» orcls::"method"«(«parameters»)» orproperty OF cls
3=x.⎕NC'method'
2=x.⎕NC'method'
[x respondsToSelector:@selector(method)]
forwardInvocation:
x respondsTo: selector
doesNotUnderstand:
opDispatch()
hasattr(x, "method") and callable(x.method)
hasattr(x, "field")
__getattr__()
x.respond_to?(:method)
method_missing()
method_exists(x, "method")
property_exists(x, "field")
__call()
__get() / __set()
x->can("method")
exists x->{field}
x.can("method")
x.field.defined
typeof x.method === "function"
field in x
self
super
nil
thisContext
me
initial
⎕THIS
⎕BASE
⎕NULL
*this
NULL, nullptr
this
base
null
null, undefined
super(current_class_name, self)
super()
None
Me
MyBase
Nothing
Me / Self
Parent
Nil
Current
Precursor «{superclass}» «(args)»
Void
$this
parent
$self
$self->SUPER
undef
SUPER
super«(args)»
binding
$NULL
SELF
NULL
⍕x
⎕SRC x
⎕NS x
x = y
x == y
x.ToString()
x.Clone()
x.Equals(y)
x.CompareTo(y)
x.GetHashCode()
System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(x)
x.toString()
x.clone()
x.equals(y)
x.compareTo(y)
x.hashCode()
System.identityHashCode(x)
x.toString() or std.conv.to!string(x)
x.stringof
x == y or x.opEquals(y)
x.opCmp(y)
x.toHash()
x.OnGetString(tempString, null, null) or PrintString(x)
y.OnCopy(x)
x.OnCompare(y)
x.description
x.debugDescription
[x copy]
[x isEqual:y]
[x compare:y]
x.hash
x < y
x.hashValue
reflect(x).objectIdentifier!.uintValue()
x displayString
x printString
x copy
x hash
x identityHash
str(x)
repr(x)
copy.copy(x)
cmp(x, y)
hash(x)
id(x)
x.out
x.twin
x.is_equal(y)
COMPARABLE
HASHABLE
x.hash_code
IDENTIFIED
x.object_id
$x->__toString()
clone x
spl_object_hash(x)
"$x"
Data::Dumper->Dump([$x],['x'])
Storable::dclone($x)
Scalar::Util::refaddr( $x )
~x
x.perl
x.clone
x eqv y
x cmp y
x.WHICH
x.to_s
x.inspect
x.dup or x.clone
x == y or x.eql?(y)
x <=> y
Oo.copy x
Hashtbl.hash x
Oo.id x
string x or x.ToString() or sprintf "%O" x
sprintf "%A" x
x = y or x.Equals(y)
compare x y or x.CompareTo(y)
hash x or x.GetHashCode()
typeid(x)
dynamic_cast<type *>(&x) != nullptr
dynamic_cast<type*>(ptr)
(type*) ptr or static_cast<type*>(ptr)
x.GetType()
x is type
(type) x or x as type
cast(type) x
x as type
x._class
eClass_IsDerived(x._class, type)
(type) x
x.getClass()
x instanceof class
[x class]
[x isKindOfClass:[class class]]
(type*) x
x.dynamicType
x as! type
x as? type
x.constructor (If not rewritten.)
TypeOf x Is type
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)
get_class(x)
ref(x)
x->isa("class")
x.WHAT
x.isa(class)
type(x) or x.type
x.class
x.instance_of?(type) or x.kind_of?(type)
x class
x isKindOf: class
x -is [type]
[type]x or x -as [type]
(x :> type)
x :? type
(x :?> type)
x AS type
using namespace ns;
using ns::item ;
using ns;
using item = ns.item;
import ns;
import ns : item;
import ns.*;
import ns.item;
Imports ns
import ns
from ns import *
from ns import item
use ns;
use ns\item;
use ns qw(item);
open ns
Spec#: type foo( «parameters» ) requires expression { body }
Spec#: type foo( «parameters» ) ensures expression { body }
f in { asserts } body{ instructions }
f out (result) { asserts } body{ instructions }
assert(expression)
invariant() { expression }
f require tag: expression do end
f do ensure tag: expression end
f do check tag: expression end end
class X invariant tag: expression end
from instructions invariant tag: expression until expr loop instructions variant tag: expression end
PRE { condition }
POST { condition }
NSObject
Object
@interface
"member_name(parameters)"
"class_name(parameters)".
class addInstVarName: field. class removeInstVarName: field.
def bar(): doc = "The bar property." def fget(self): return self._bar def fset(self, value): self._bar = value return locals() bar = property(**bar())
x->method(«exporting parameter = argument» «importing parameter = argument» «changing parameter = argument» «returning value(parameter)»
parameter = argument
BaseClassName::member
option
Some x
==
clone()
Cloneable
Comparable
copyWithZone:
compare:
Printable
DebugPrintable
Equatable
hashValue
__str__()
__repr__()
__copy__()
__eq__()
__cmp__()
__hash__()
__clone()
x
object_getClass(x)