As a very large language used for a very wide range of purposes over many decades, C++ can be written in a lot of different ways. Today we’ll look at some of the norms for “modern” C++ to get a sense of how code is normally written.
Posts Tagged initialization
We’ve actually seen quite a bit of implicit type conversion so far in the series. We’ve converted integers to floats (
float f = 123), arrays to pointers (
int* p = a), base type pointers to derived type pointers (
D* p = &b), and many more. Today we’ll gather all those casual conversions up into one article that goes over all the rules, including user-defined type conversions.
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!