O'Reilly logo

Learning D by Michael Parker

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 3. Programming Objects the D Way

In this chapter, we're going to build upon the foundation established in the previous chapter by looking at D's user-defined types, its support for object-oriented programming, and some peripherally related features. By the end of the chapter, we'll be finished with the basics of D and ready for more advanced topics. Here's our checklist:

  • User-defined types: enumerations, unions, structs, and classes
  • Working with objects: protection attributes, constructors, and destructors
  • Contract programming: contracts and invariants
  • Error handling: exceptions and asserts
  • MovieMan: adding menus via user-defined types

User-defined types

This section shows how to define custom types using enum, union, struct, and class. The latter ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required