FANDOM


Random stuff.

  • Difference between an abstract class and an interface class
    • Abstract classes are basically "incomplete" classes that hint towards what extending classes should be doing. It may or may not include implementation.
    • Interface classes are basically a list of required methods that extending classes must implement. It doesn't include implementation.
    • An abstract class is a contract between class/API developers, while an interface is a contract between class developers and API users.

Question: so what's the use of an interface class anyway?

  • A class can only inherit a single class, but it can implement multiple interfaces.
    • This is probably because an interface class contains no body; without a body, the diamond problem found in multiple inheritance (i.e., C++) doesn't arise.
  • __autoload() is used to load a class' required external files.
  • PHP5 classes are passed by reference (no need for $foo = &$bar probably).