|< .Net Type, Variable & Operator 2 | Main | .Net Type, Variable & Operator 4 >|
|
The discussion and the codes used supposed to be based on the new C++ .NET. The following are the topics in this part.
Adding Member Variables to Classes
Adding Member Variables to Classes
|
|





Note that the header file for the new class, Animal.h, has been loaded into the main window. In Solution Explorer, the Animal.cpp file has been added to the Source Files folder and the header file, Animal.h, has been added to the Header Files folder.

In the Class View window, if you expand the Variables project node, you’ll see that the new Animal class has been added to the project. If you expand the Animal class, you’ll see the default constructor, Animal(void), and destructor, ~Animal(void), for the class.

|
Name |
Type |
Access |
|
legs |
int |
public |
|
Table 5 |
||

In this exercise, you’ve seen how to create a new class using Visual C++/Studio and how to add members to it.