Chapter

Constructors

From ComputerScienceOne by Dr Chris Bourke

Concepts

  1. Why are getters, setters, and immutable member variables useful?

    "Controlling access of member variables through getters and setters is good encapsulation. Doing so makes your code more predictable and more testable. Making your member variables public means that a

  2. How does a constructor initialize a PHP object?

    "If we make the (good) design decision to make our class immutable, we still need a way to initialize the values. This is where a constructor comes in. A constructor is a special method that specifies

Constructors | ComputerScienceOne | Bifalgorithm | Bifalgorithm