12. Class Anatomy Part I: ststic Class Members and Method Adventures

   


Chapter 12. CLASS ANATOMY PART I: static CLASS MEMBERS AND METHOD ADVENTURES

You will learn about the following in this chapter:

  • The different class members

  • static instance variables

  • static methods

  • Reference parameters

  • Output parameters

  • The parameter array

  • Method overloading

  • The keyword this

Recall that a class provides a blueprint for creating an object, just like an architectural drawing specifies how to build a house. The class is an abstraction of a real-world (tangible or conceptual) object that belongs to, for our program, a relevant problem domain. A single class template can be used to create numerous objects (instances) that all share the features specified by this particular class.

In previous chapters, we saw how to solve several different computational problems by letting suitable objects of different classes collaborate, each contributing with its unique abilities. The class construct allows us to combine data (collectively referred to as the state of the object) with functions (representing the behavior of the object) to form useful objects that fit into our overall software design. So far, our classes have consisted of instance variables and methods as shown in Figure 12.1.

Figure 12.1. A class with instance variables and methods.
graphics/12fig01.gif

Class members are the language elements constituting the class body. Instance variables and methods are two fundamental class members, but because the classes we write as so diverse and via their objects interact in many different situations, C# contains several other class members that allow you to make each class more agile, intuitive and easier to use for other classes and programmers and tailor fitted for its particular role in a program. We will focus on these other class members in this and the next two chapters and also look more closely at important aspects of the method construct we have not yet discussed.


   


C# Primer Plus
C Primer Plus (5th Edition)
ISBN: 0672326965
EAN: 2147483647
Year: 2000
Pages: 286
Authors: Stephen Prata

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net