O'Reilly logo

Foundations of C++/CLI: The Visual C++ Language for .NET 3.5 by Gordon Hogenson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required