Break Time — Saint Petersburg

[ We’ve been having some funkiness going on with our caching plugin. If you went to http://www.learncpp.com and ended up here instead, please post a comment and let us know. Thanks! ] Saint Petersburg is a board game originally released in 2004 by Bernd Brunnhofer, Michael Tummelhofer, Jay Tummelson, and …

25.8 — Virtual base classes

Last chapter, in lesson , we left off talking about the “diamond problem”. In this section, we will resume this discussion. Note: This section is an advanced topic and can be skipped or skimmed if desired. The diamond problem Here is our example from the previous lesson (with some constructors) …

24.9 — Multiple inheritance

So far, all of the examples of inheritance we’ve presented have been single inheritance — that is, each inherited class has one and only one parent. However, C++ provides the ability to do multiple inheritance. Multiple inheritance enables a derived class to inherit members from more than one parent. Let’s …

24.6 — Adding new functionality to a derived class

In the introduction to inheritance lesson, we mentioned that one of the biggest benefits of using derived classes is the ability to reuse already written code. You can inherit the base class functionality and then add new functionality, modify existing functionality, or hide functionality you don’t want. In this and …