Here's a couple of articles to study:
http://www.microsoft.com/officedev/articles/movs109.htm
http://www.vb-world.net/books/vb6objects/sample7.html
Danger, Danger! Opinions Ahead!
(Coming from somebody who hasn't done a lot of Class programming)
Okay, let's say that you are deep into a project, the basics are in place, the program is actually 'working'. Have you created a ton of variables that each seem to have the same phrase in them?
Let's say you have created a program to assist you on picking the guys you hang with on Friday night.
You might be checking your friends for:
Do I owe them money?
Do they owe me money?
Am I currently dating their ex-girlfriend?
Do they work Friday night?
What time do they get off, if they do work Friday night?
Are they currently grounded, or in jail?
Is their car running?
Have their parents forbidden them to associate with you?
Don't forget a rating, from 0-to 10.
Might as well keep their phone number(s) in the database...
You could find yourself with:
Code:
Dim JoeOwesMe as Boolean
Dim EddyOwesMe as Boolean
Dim JohnnieOwesMe as Boolean
Dim SamOwesMe as Boolean
Dim DatingJoesEx as Boolean
Dim DatingEddysEx as Boolean
Dim DatingJohnniesEx as Boolean
Dim DatingSamsEx as Boolean
Sub IM_MyBuddy(ThisBuddy as Integer)
....
....
.....
End Sub
So, without class, you would need to hard-code each friend's values; adding a friend would entail a lot of code. A bunch of arrays could also work, but you would have to work at tying them together.
However.......
With a MyFriends object, you could do things like:
Set Eddy as New MyFriends
Eddy.InitializeDataBase
With Eddy
If .NotGrounded And Not .OweHimMoney And Not .DatingHisEx Then
.Send_IM_AndAskWhatHesDoingFridayNight
If .NotBusyFridayNight Then
.AddToList
End If
End With
Now, before you take my advice as gospel, let's see what the others have to say about this subject.
Okay guys, let's hear from you all.