Summary


This chapter has presented you with a full description of object-oriented techniques. You have gone through this in the context of C# programming, but this has mainly been illustrative. The vast majority of this chapter is relevant to OOP in any language.

You started by covering the basics, such as what is meant by the term object and how an object is an instance of a class. Next, you saw how objects can have various members, such as fields, properties, and methods. These members can have restricted accessibility, and you looked at what is meant by public and private members. Later on, you saw that members can also be protected, as well as being virtual and abstract (where abstract methods are only permissible for abstract classes). You also looked at the difference between static (shared) and instance members, and saw why you might want to use static classes.

Next, you took a quick look at the lifecycle of an object, including how constructors are used in object creation and destructors are used in object deletion. Later on, after examining groups of members in interfaces, you looked at more advanced object destruction with disposable objects supporting the IDisposable interface.

Most of the remainder of the chapter covered the features of OOP, many of which you'll be seeing in more depth in the chapters that follow. You looked at inheritance, where classes inherit from base classes; two versions of polymorphism, through base classes and shared interfaces; and how objects can be used to contain one or more other objects (through containment and collections). Finally, you saw how operator overloading can be used to simplify the syntax of object usage and how objects often raise events.

The last part of this chapter demonstrated much of the theory in this chapter, using a Windows application as an example.

In this chapter you learned:

  • What object-oriented programming is

  • The key terms and features of OOP

  • How to create, use, and delete an object

  • How to use OOP in a Windows application

In the next chapter, you look at defining classes using C#.




Beginning Visual C# 2005
Beginning Visual C#supAND#174;/sup 2005
ISBN: B000N7ETVG
EAN: N/A
Year: 2005
Pages: 278

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