Classes are templates for objects. The name of a class should have the first letter capital and the rest in camalcase.
An instance is an object that contains the property name and method of a class.
When we create a new instance with the keyword new, the constructor method is called.
Note: class methods and getter syntax are the same with objects. BUT no commas between methods.
To call a method: instance.methodname()
Inheritance allows the child class to use share property and method. The extend keyword makes the method and getters of parent class available in the child class. The super keyword calls the constructor method in the parent class.
Static method can only be called directly from the class. It can't be used on an instance of a class or subclass. (don't forget the () at the end)
example code:
Top comments (0)