Library tutorials & articles
Introduction to Class Programming
Fundamental Concepts About Class
Before diving into object-oriented programming let try to understand some concepts that will help you later in the articles.
Encapsulation
Encapsulation is the process of combining logically related procedure and data in one class/objects. This way, each object is insulated (separated, protected) from the rest of the program. Because the object is only using data contained within it or passed to it. And it executes only internal procedures. It does not contain any global or public variables, and does not require any external procedures to execute its members. The data and behaviors of an encapsulated object can only be accessed and manipulated through its properties and public methods. Thus encapsulation provides several advantages for you as a programmer. You can protect data from corruption by other objects or parts of the program. You can hide low-level, complex implementation details from the rest of the program, which results in the ability to implement a simple public interface to a more complex set of private member. It is also easier to maintain legacy code or add new members to the object without affecting any procedures that currently call the object. You can to debug individual object and ensure that a bug in one object will not affect some other part of the system in an apparently unconnected way. And lastly, you can reuse the object or by other programmer, improving the productivity.
Polymorphism
Polymorphism is the ability of different classes to expose similar (or identical) interfaces to the outside. The most unmistakable kind of polymorphism in Visual Basic is forms and controls. For example, TextBox and PictureBox controls are completely different objects, but they have some properties and methods in common, such as Left property and Move method. As a programmer, you don't need to worry about how they implement its functionality, instead, all you have to do is to apply it to a supported object and pass a correct value as arguments.
Inheritance
Inheritance is the ability to derive a new class (the derived or
inherited class) from another class (the base class). The derived class automatically
inherits the properties and methods of the base class. For example, you could
define a generic Person class with properties such as FirstName and
Lastname and
then use it as a base for more specific classes (for example, Student, Faculty,
and so on) that inherit all those generic properties. You could then add
specific members, such as BirthDate and StudentID for the
Student class and
FacultyID for the Faculty class. Thus it reduce the amount of code
on your class itself, therefore simplifies
the job of the class author. Unfortunately, Visual Basic doesn't support
inheritance, at least not in its more mature form of implementation inheritance.
Related articles
Related discussion
-
Run-time error '91'
by converter2009 (1 replies)
-
VB6 Runtime error 381 subsript out of range Error
by Uncle (2 replies)
-
passing and reading parameters from using Shell
by jigartoliya (0 replies)
-
Convert C++ code to VB6
by mawcot (4 replies)
-
listbox scrollbar
by Dennijr (10 replies)
Related podcasts
-
Christian Beauclair
14 mai 2008 (�mission #0074) ::.Christian Beauclair: Stratégies de migration VB6 vers .NET Nous discutons avec Christian Beauclair des stratégies de migration VB6 vers .NET. Entre autres, nous discutons comment utiliser le "VB 6 Code Advisor" et le "Interop Forms Toolkit" pour ajouter la puiss...
Wouw, thanks for this great explanation on how to use and make classes. I always coded in VB with function in normal Modules, now i'm going one step further... Trying it out...
!--removed tag-->Great Tutorial !! Helped me a lot
!--removed tag-->[quote user="Developer Fusion Bot"]
This thread is for discussions of Introduction to Class Programming.
[/quote]
This was the best explanation to "class", I have ever come across. Hats off to you.
Hello Sir,
I have just seen u'r examples for class module.u'r explaination is simply superb!!!!
now i clearly understood the class module concept in VB.
Thanks
Bhavani Josyula
It s a great sample about the class programming. However, it s still uncertain for me where I can use this in real life.
Can anyone give me an example ?
what kind of help you wants from me. i mean to clear out your visual basic basics by giving you some tutorials or anything else. bye
I would appericiate if u can show me the way to learn this programe.
TQ
I have worn Google to a frazzle looking for help. most of which was comprised of a few samples.
You have helped "elucidate" me with both the why and how-to and that is no small task.
Thanks so much for your efforts and help.
What a tutorial !! man i like it. this tutorial shows me another side of visual basic wow!!
This is really a good tutorial on Visual Basic. I was really coinfused between let, get properties. But this is the final place which solved ll my problems
vbexplorer.com has also an excellent oop tutorial, if youre looking for some more,
and I have found a german article at vbarchiv.de that seems very good (i can
tell because I studied german when in grad. school, swe).
Maybe I should try an translate it to english...
This thread is for discussions of Introduction to Class Programming.