Destructors in C++

We’ve looked at Constructors in C++ to create an object, and building an object with new. However, what happens when we no longer need that object? That’s where a destructor is called. It is built into all objects, and if you don’t define one, a default one will be called for you. The destructor’s job…

Defining New Datatypes

OK, defining a new Datatype might be a bit of a stretch…how about, defining aliases? You can use the typedef keyword to define a new aliase for an existing data type in C++. The general form is: Let’s say you have experience with another language and you want to use a datatype name that they…

Pointer Basics in C++

A Pointer variable, just called a pointer, holds the memory address of data that is stored. Through the pointer, you can read the address, and thus indirectly access the value of the variable. To access a value, you use the dereference operators (*) to get the value stored at that memory address. To store a…