Chapter 9. Inside Methods

   

Chapter 9. Inside Methods

In Chapter 8, you saw that classes consist of fields and methods. Fields hold the state of the object, and methods define the object's behavior.

In this chapter, you'll explore how methods work in more detail. You've already seen how to create methods. In this chapter, you'll learn about method overloading, a technique that allows you to create more than one method with the same name . This allows your clients to invoke the method with different parameter types.

This chapter also introduces properties. Properties look to clients of your class like member variables , but properties are implemented as methods. This allows you to maintain good data hiding, while providing your clients with convenient access to the state of your class.

Chapter 8 described the difference between value types (i.e., primitives like Integer, Long, etc.,) and reference types (i.e., classes). This chapter explores the implications of passing value types to methods and shows how you can pass value types by reference , allowing the called method to act on the original object in the calling method.

   


Learning Visual Basic. NET
Learning Visual Basic .Net
ISBN: 0596003862
EAN: 2147483647
Year: 2002
Pages: 153
Authors: Jesse Liberty

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