Object oriented functions in Visual Basic 6.0
Hello friends, I wanted to know what Object oriented functions in Visual Basic 6.0 are. Is it supportable in Visual basic 6.0 or not? I think that it is available but I am not sure whether all functions are available in Visual basic 6.0 or not. I am very much confused with some of the terms of object oriented programming. Will it affect in visual basic 6.0 or what? If anyone having any information then please let me know as soon as possible.
Re: Object oriented functions in Visual Basic 6.0
Combining the characteristics which is properties and behavior which is methods of an object into a single package is known as Encapsulation. Encapsulation is also called data hiding because the object can hide its data and procedures using the Private keyword. The data and procedures to be exposed can be defined using the Public keyword. You can change the values of the properties of an object or execute its methods, but you cannot change or add new properties and methods.
Re: Object oriented functions in Visual Basic 6.0
For example, you can set or retrieve the properties of a command button such as Caption or Width, you can execute its methods such as Move and SetFocus and you can write code for its different events such as Click event and DblClick event, but you cannot add new properties and methods. Polymorphism is the ability to take more than one form. In Visual Basic, polymorphism is giving same names to the methods of different objects. In standard OOP, polymorphism is giving same names to different methods of the same object
Re: Object oriented functions in Visual Basic 6.0
For example, the objects such as Printer, Form, PictureBox and Debug all have a method named Print. Although the names are same, the methods of different objects act differently. The Print method of an object sends the output to that object. You can implement polymorphism in VB by using standard naming conventions so that the action can be recognized by its name. For example, don't use Clear for one class, Blankout for another, and Empty for another.
Re: Object oriented functions in Visual Basic 6.0
It must be possible to use the functionality of an existing class in a new class which is similar to the existing class. In Visual Basic, reusability is provided using interfaces and a procedure called delegation. To share functionality using delegation, a base class or superclass is created which contains the code to be shared. Then other classes called subclasses are created which may call the shared functions. For example, the Option button and Check Box classes have similar functionality. They can share a superclass which contains the common functions. The uncommon functions can be written in separate subclasses.