Chapter 3. D's Object-Oriented Features
All the programming languages in the C family provide a way to encapsulate data and operations through the simple struct or the more complex class. D includes support for both classes and structs, but the rules that govern their usage may not be what you are used to from other C languages. For example, D structs are similar to those found in C++ in that they may have methods, but unlike C++ structs, they may not be extended through inheritance. Classes in D are similar to those found in Java in that only single inheritance is supported. Also as in Java, a D class may implement multiple interfaces.
While structs and classes are the main means to encapsulate in D, the language provides a default encapsulation ...
Get Learn to Tango with D now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.