OOP:Object Oriented ProgrammingName: Understanding OOP Author: Derrick Mead Date: 8/18/97
Description: Volumes could be written about OOP and Visual Basic. Here we skim the vital concepts and show some code samples that may be of use as you learn. Many thanks to Derrick for graciously providing this tutorial; check out his VBJones Web Site.
Controls needed: N/A
What is Object Oriented Programming?Object Oriented Programming allows developers to mimic real world items and concepts. In an OOP world, each object knows what information describes itself and what actions it can perform with that information. OOP allows developers to create reusable objects that interact with each other to form complex entities.
A "Class" is a template which defines the attributes (properties in VB) and the actions or methods which can be performed upon those attributes for a given type of entity. The class definition is used to create "Instances" of the class, which are the actual objects used within your application. A Class is generally considered to be a "Black Box". That is, you can use the object created from a Class without knowing how the internal code works. All the developer needs to know is which methods to call to perform certain functions. How those functions perform their tasks is hidden. Programmers generally create a Class for each separate entity used within their application. Classes allow developers to write modifiable,
readable, reusable code.
An object is an "Instance" of a Class. In Visual Basic you can create any number of "Object Variables" from a single Class Definition. Each object knows what data describes it and how to manipluate that data. Each data item is called an "Attribute" in OOP. Visual Basic implements these attributes as "Properties". Properties are exposed through the Public Interface of an object. Each object can have internal variables, not seen by users, which are used to store information the object requires to perform its task(s). Figure 1.2a : An Object Which Exposes Public Properties
Objects not only contain their own data but they know how to perform tasks on that data. Tasks are performed by various functions and procedures defined in the Class Definition.These functions and procedures are called Methods in OOP. Once again only those Methods exposed by the Public Interface are available to outside users. Figure 1.2b : An Object Which Exposes Public Methods
[Lesson 1 , Lesson 2]
|
Quick searches: Site Search | Advanced Site Search |
|
By using this site you agree to its terms and conditions VB Explorer and VBExplorer.com are trademarks of Exhedra Solutions, Inc. |