ch11 - Microsoft Visual Basic 2008 Reloaded Third Edition...

Info iconThis preview shows pages 1–13. Sign up to view the full content.

View Full Document Right Arrow Icon
Microsoft Visual Basic 2008: Reloaded Third Edition Chapter Eleven Creating Classes and Objects
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Microsoft Visual Basic 2008: Reloaded, Third Edition 2 Objectives After studying this chapter, you should be able to: Define a class Instantiate an object from a class that you define Add Property procedures to a class Include data validation in a class Create default and parameterized constructors
Background image of page 2
Microsoft Visual Basic 2008: Reloaded, Third Edition 3 Objectives (continued) Include methods in a class Overload the methods in a class Create a derived class using inheritance Override a method in the base class Refer to the base class using the MyBase keyword
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Microsoft Visual Basic 2008: Reloaded, Third Edition 4 Classes and Objects Class : a pattern or blueprint used to create an object Object-oriented programming (OOP): based on using objects that are instantiated (created) from classes Each object called an instance of the class from which it was created Attributes : characteristics that describe the object Behaviors : methods and events of the class
Background image of page 4
Classes and Objects (continued) Methods : operations that the object is capable of performing Events : actions to which an object can respond A class encapsulates (contains) all of the attributes and behaviors of the object it instantiates VB.Net has many built-in classes, including its GUI controls Ability to reuse an object saves programming time and money Microsoft Visual Basic 2008: Reloaded, Third Edition 5
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Microsoft Visual Basic 2008: Reloaded, Third Edition 6 Defining a Class Can define your own classes and create instances (objects) from them Must specify the attributes and behaviors of the objects created from the class Class statement : defines a class Use Pascal casing for the class name Define attributes and behaviors of the class within it Attributes represented by variables and Property procedures Code editor automatically adds the Class statement when you create a class
Background image of page 6
Microsoft Visual Basic 2008: Reloaded, Third Edition 7 Defining a Class (continued) Figure 11-1: How to define a class
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Microsoft Visual Basic 2008: Reloaded, Third Edition 8 Defining a Class (continued) Figure 11-2: How to add a class file to an open project
Background image of page 8
Microsoft Visual Basic 2008: Reloaded, Third Edition 9 Figure 11-3: Completed Add New Item – projectName dialog box
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Microsoft Visual Basic 2008: Reloaded, Third Edition 10 Defining a Class (continued) Figure 11-4: TimeCard.vb file opened in the Code Editor window
Background image of page 10
Microsoft Visual Basic 2008: Reloaded, Third Edition 11 Figure 11-5: How to instantiate an object from a class
Background image of page 11

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
12 Example 1 – Using a Class that Contains Public Variables Only Sweets Unlimited application Need to save each salesperson’s name, sales amount, and bonus amount in a sequential file Figure 11-6: Salesperson class defined in the Salesperson.vb file
Background image of page 12
Image of page 13
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 03/05/2010 for the course CIS 2656 taught by Professor Marvpelot during the Winter '08 term at Oakland CC.

Page1 / 64

ch11 - Microsoft Visual Basic 2008 Reloaded Third Edition...

This preview shows document pages 1 - 13. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online