Angular: Visibility in Classes

By default, a property in a class has public visibility. class Trinket { name: string; constructor (name: string) { this.name = name; } } We can access the 'name' property…

Angular: Interfaces

Interfaces can be used to ensure that an object has certain properties. For example: interface Weapon { name: string; type: string } We can then say: let myWeapon: Weapon; myWeapon…

PHP: Static Properties and Methods

Static Property: <?php class Automobile { public static $colorRed = "red"; } echo Automobile::$colorRed; A Class can use the keyword self to reference itself within a static method. <?php class…

PHP: Constants

You can create a Constant variable within a Class: class Automobile { const AVG_COST = 5000; } AVG_COST will be static (you don't need to instantiate an Automobile object to…