O'Reilly logo

C# Primer Plus by Klaus Michelsen

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

Data Members

The following sections look closer at the data members. Previous chapters have already covered instance variables, so the bulk of this part is about static variables and their use.

Instance Variables

When an object is created, its instance variables are filled with values specific to that object, and their values stay specific to this object throughout its lifetime. This mechanism is familiar territory, but worth recapturing to contrast it with static variables discussed in the next section.

Recall our BankSimulation.cs program in Chapter 10, “Arrays Part I: Array Essentials.” It consisted of a Bank object referencing a number of Account objects through an array called accounts. The Account class defined, among others, an instance ...

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