classes in D

A class is where D’s object oriented features live.

Some quick facts:

  • All classes inherit for a root class, Object
  • classes may have only one super class but can implement many interfaces (just like Java)
  • methods are virtual by default (again, just like Java)
  • The default protection attribute is public
  • The constructor is defined like: this()
  • objects live on the garbage collected heap