Other Languages

Php Oop, Object Instantiation

A class is only a blueprint
Before use, it must be instantiated

$a = new A;    
echo $a->foo;

Java Basics, Objects

Reference variable is forever of that type
Reference to an object can be overridden

Book a = new Book(); Book b = new Book();
b = a; // objB is destroyed
Objects, Reference, Garbage

Python Class, Attributes

Assign values to an instance using dot

class Point:
  # a 2D point
p = Point()
p.x = 1


Javascript Objects, Basics

Object are created using figure brakets {}
A property is a (key:value) pair
Computed properties, use square brakets

let A = { age: 30, [myvar]: 3, }
for (key in A) // A[key]