In the previous chapter, I covered in detail the basics of Managed C++, focusing on programming strictly in a procedural style. This chapter explores the real strength of Managed C++: as an object-oriented language.
You will start by reviewing object-oriented programming (OOP) in general. You will then explore Managed C++'s OOP capabilities, focusing primarily on managed classes, which are the cornerstones of Managed C++ OOP. You will do this by breaking classes down into their parts and examining each part in detail. You will then revisit __value structs and __value classes. Finally, you will learn about managed interfaces.
Don't skip this chapter, even if you know C++ very well, as several things are different between traditional C++ and Managed C++. True, some of the changes may not be significant, but recognizing and understanding these changes now may make your life easier in the future.
OOP is more a way of thinking than a programming technique. For those making the transition from procedural programming, you must understand that OOP programming will involve a paradigm shift for you. But, once you realize this and make the shift, you will wonder why you programmed any other way.
OOP is just an abstraction taken from everyday life and applied to software development. The world is made up of objects. In front of you is a book. It is an object. You are sitting on a chair or a couch, or you might be lying on a bed—all objects. I could go on but I'm sure you get the point. Almost every aspect of our lives revolves around interacting with, fixing, and improving objects. It should be second nature to do the same thing with software development.