CHAPTER 6Classes and Structs

Since you already know the basics of how classes (and structs) are handled in C++, this chapter will focus on the differences between native classes and managed classes. Because the C++ type system exists intact alongside the managed type system in C++/CLI, you should keep in mind that the C++ behavior is still true and valid in C++/CLI native types.

Structs are the same as classes except that in a struct, the members are public by default, and in a class, they are private. Also, inheritance is public by default for structs, but private by default for classes. To avoid needless repetition, I will just use the term class, and it shall be understood to refer to both.

At a glance, the major differences are that there ...

Get Foundations of C++/CLI: The Visual C++ Language for .NET 3.5 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.