Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Now that we have our classes set up, it’s time to start adding some members to them. We’ll start with the Ingredient class. You can add class members in the Diagram pane or the Class Details pane of the Class Designer. I find it easier to use the Class Details pane, but let’s try the Diagram pane so you can decide for yourself.
5 Right-click the Ingredient class in the Diagram pane and choose Add, Field. Visual Studio will add the field to both the diagram and the Class Details pane.
Change the name of the field to m_quantityOnHand.
You’ll see in the Class Details pane that Visual Studio has set the field to its default values, an int (which, you’ll recall, is a .NET Framework Int32) with private accessibility. That’s what we need here, so you don’t need to change anything.