Summary
In this chapter, we saw how the concept of classes can be used in C++. We started by delineating the advantages of using classes, describing how they can help us to create powerful abstractions.
We outlined the access modifiers a class can use to control who has access to class fields and methods.
We continued by exploring the conceptual differences between a class and its instances, along with the implications this has when implementing static fields and static methods.
We saw how constructors are used to initialize classes and their members, while destructors are used to clean up the resources that are managed by a class.
We then explored how constructors and destructors can be combined to implement the fundamental paradigm C++ is famous for: RAII. We showed how RAII makes it easy to create classes that handle resources and make programs safer and easier to work with.
Finally, we introduced the concept of operator overloading and how it can be used to create classes that are as easy...