Chapter 11 Summary


[Page 601 (continued)]

  1. An object is an entity that stores data, has methods that manipulate the data, and can trigger events. A class is a template from which objects are created. A method specifies the way in which an object's data are manipulated. An event is a message sent by an object to signal the occurrence of a condition.

  2. Each class is defined in a separate block of code starting with Class className and ending with End Class. Data are stored in member variables and accessed by procedures called properties.

  3. A property routine contains a Get block to retrieve the value of a member variable or a Set block to assign a value to a member variable. These procedures can also be used to enforce constraints and carry out validation.

  4. Visual Basic automatically invokes a New procedure when an object is created.

  5. An object variable is declared with a statement of the form Dim objectName As className, and the object is created with a statement of the form objectName = New className(arg1, arg2, ...). These two statements are often combined into the single statement Dim objectName As New className(arg1, arg2, ...).


  6. [Page 602]
  7. Events are declared in the Declarations section of a class with a statement of the form Public Event UserDefinedEvent(arg1, arg2, ...) and triggered with a RaiseEvent statement. The declaration statement for the object must include the keyword WithEvents in order for the events coming from the object to be processed. The header of an event-handling procedure has the form Private Sub procedureName(par1, par2, ...) Handles objectName. UserDefinedEvent.

  8. The properties, methods, and events of a class are referred to as its interface.

  9. Inheritance, which is implemented with the keyword Inherits, allows a new class (called the derived or child class) to be created from an existing class (called the base or parent class) and to gain its interface.

  10. Polymorphism is the feature that two classes can have methods that are named the same and have essentially the same purpose, but different implementations.

  11. The keywords, Overridable, Overrides, MustInherit, and MustOverride allow derived classes to customize inherited properties and methods.




An Introduction to Programming Using Visual Basic 2005
Introduction to Programming Using Visual Basic 2005, An (6th Edition)
ISBN: 0130306541
EAN: 2147483647
Year: 2006
Pages: 164

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