Tag Archives: c++

Overriding or Overloading in C++?

Occasionally I’ve heard these terms used interchangeably – but they actually refer to two completely separate concepts. So what’s what? Overloading describes the creation of a method with the same name as an existing method, but different parameters. For example: int method(); int method(int); int method(int, double); Overriding describes the creation of a method in […]

Initialization Lists in C++

When you first start using C++ you tend to set member variables with default values inside your constructor. For example, you might have a class called Message that has three variables, and your constructor sets the default values like this: Message::Message() { messageLength = 0; messageType = 0; messageBody = “Empty message”; } This is […]

What is Encapsulation?

This is the final post in the series of the three cornerstones of object oriented programming. Next week I’m going back to a nice low-level subject – the bitwise operators :-). So. What is encapsulation? I previously defined this as the¬†ability of objects* to maintain their internal workings independently from the program they are used […]

What is Inheritance?

Today we’ll take a look at inheritance* – the second cornerstone of object oriented programming, as explained in my 5 minute guide to OOP. In that post, I described inheritance as the ability of objects to derive behaviour patterns from other objects. But what does this mean in practice? An object can inherit behaviour (in […]