C++ For C# Developers: Part 18 – Exceptions

Like C#, C++ also uses exceptions as one of its main error-handling mechanisms. Today we’ll learn all about them: throwing, catching, their impact on destructors, what happens when they go uncaught, and so much more.

Read the rest of this article »

C++ For C# Developers: Part 17 – Namespaces

With structs wrapped up, we can move on to other features of C++. Today we’ll take a look at namespaces. We’ll cover the basics that C# provides, but go so much further and cover a lot of advanced functionality. Read on to learn all about them!

Read the rest of this article »

C++ For C# Developers: Part 16 – Struct and Class Wrapup

Today we’ll wrap up structs and classes by discussing a bunch of miscellaneous features: local classes, unions, overloaded assignment operators, and user-defined literals. C# doesn’t have any of these features, but it can emulate some of them. Read on to learn a bunch of new tricks!

Read the rest of this article »

C++ For C# Developers: Part 15 – Struct and Class Permissions

Today we’ll cover the last major topic of structs in C++: how we control access to them. We’ll talk about access specifiers like private, the “friendship” concept, and finally get around to the details of const.

Read the rest of this article »

C++ For C# Developers: Part 14 – Inheritance

Now that we know how to initialize structs and other types in C++, we can take a look at inheritance and learn how to make structs derive from each other. There’s a lot of extended functionality here compared to C# class inheritance. Read on to learn the basics as well as advanced features like multiple inheritance and virtual inheritance!

Read the rest of this article »

C++ For C# Developers: Part 13 – Initialization

With constructors under our belts, we can now talk about initialization of structs and other types. This is a far more complex topic than in C#. Read on to learn a lot of nitty-gritty details!

Read the rest of this article »

C++ For C# Developers: Part 12 – Constructors and Destructors

So far with structs we’ve covered data members, member functions, and overloaded operators. Now let’s talk about the main parts of their lifecycle: constructors and destructors. Destructors in particular are very different from C# and represent a signature feature of C++ that has wide-ranging effects on how we write and design code for the language. Read on to learn all about them!

Read the rest of this article »

C++ For C# Developers: Part 11 – Struct Functions

Now that we’ve covered the basics of structs, let’s add functions to them! Today we’ll explore member functions and overloaded operators.

Read the rest of this article »

C++ For C# Developers: Part 10 – Struct Basics

Let’s continue the series today by starting to look at structs. These are far more powerful in C++ than in C#, so today we’ll start with basics like defining and initializing them. Read on to get started!

Read the rest of this article »

C++ For C# Developers: Part 9 – Enumerations

We’ll continue the series today by discussing enumerations, which is yet-another surprisingly-complex topic in C++. We actually have two closely related concepts of enumerations to go over today, so read on to learn all about both kinds!

Read the rest of this article »