Instance Members
Home ] Up ] [ Instance Members ] Instance Methods & this ] Intializers & final Values ]

 

 

What does being an instance member mean?

Here's a picture that will help you conceptualize things (I hope!).

We have a class defined as follows:

class Circle
{
  //...
  double m_r;
  //...
}

(we're concentrating on the important parts, and ignoring the details)

and we create three instances of this class:

Circle c1 = new Circle();
Circle c2 = new Circle();
Circle c3 = new Circle();

Here's what the result looks like:

That is, each instance retains its own copy of the instance variable m_r, and thus the value of m_r is specific to each instance.

 

This page was last modified on 02 October, 2007