C++ Constructors

Let’s look a little closer at constructors than we did in our initial Defining Classes for Objects example. Anytime you create an object, a constructor is called. If you overload your constructor, C++ will pick the right constructor to call, just like it does when you overload a function. Constructors must have the same name…

Creating an Object

Once you create your class, you need to create an object. The Class is just a blueprint for the program to follow. It doesn’t do anything until you create an object based off of that blueprint. Think of a house. If you have a house blueprint, all you have are some sheets of paper or…

C-Strings in C++

A C String is actually an array of characters. While C strings are a thing, generally speaking it is best to use the C++ string object. However, if you run into an older application, or someone who wants to do things old style, it is good to know how to use a C-String. Additionally, any…