OBJECT-ORIENTED PROGRAMMING


OOP (object-oriented programming) is a major feature of Visual Basic. In OOP, data and code are grouped together as objects. Objects are, in effect, self-contained entities. As an example, think about the Visual Basic forms and controls with which you have been working. Each of these represents a different type of object. Objects can store data and provide a carefully designed interface for accessing their data and exercising their functionality. This access is provided through object properties and methods. Objects also have the ability to validate any data that is passed to them and to reject it if it fails to meet certain predefined criteria. Thus, properly defined objects make applications more reliable.

Because objects control access to themselves and to their data, you can think of them as being like a black box, meaning that while you may know what a given object does and how to use it, you don't really know how it was put together or what makes it work. For example, think about the Form object. Every chapter game project that you have worked on has used one, yet you never had to create one. Visual Basic makes forms available to you as classes. Forms have their own properties, such as background color and foreground color, which you do not have to define or validate. Forms have methods associated with them, such as maximize and minimize, which you do not have to define. All you have to know is how to add new controls to your forms in order to modify them. Forms also have events, like the Load event, to which they automatically know how to respond.




Microsoft Visual Basic 2005 Express Edition Programming for the Absolute Beginner
Microsoft Visual Basic 2005 Express Edition Programming for the Absolute Beginner
ISBN: 1592008143
EAN: 2147483647
Year: 2006
Pages: 126

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