|
-
Nov 29th, 2010, 06:44 AM
#1
Thread Starter
Junior Member
Objects
Hello.
For some reason I'm having a hard time understanding the point of using objects. After a bit research on my own, I've concluded that the easiest way to explain the point of objects is:
- A lot of slightly different objects can use the same properties and methods, without interfering with each other.
Is this the right way to see it from a beginners point of view?
Please correct me if this is wrong.
Last edited by visualjeesuss; Nov 29th, 2010 at 07:03 AM.
-
Nov 29th, 2010, 07:42 AM
#2
Re: Objects
All beginners should become familiar with MSDN
http://social.msdn.microsoft.com/Sea...s?query=object
The first item returned from the search would be a great place to start.
-
Nov 29th, 2010, 08:33 AM
#3
Re: Objects
Objects are basically for the human. It makes things easier to understand, plus provides encapsulation (all code related to a specific object is contained by that object).
For example you can have a program with these variables:
Code:
intFormLeft as integer = 50
intFormTop as integer = 100
intWheels as integer = 4
strColor as string = "Red"
strMake as string = "Ford"
strModel as string = "Pinto"
strUser as string = "Me"
strPassword as string = "Secret"
Or using objects, it is a little more self-documenting:
Code:
intFormLeft as integer = 50
intFormTop as integer = 100
MyCar as New Car
MyCar.Wheels = 4
MyCar.Color = "Red"
MyCar.Make = "Ford"
MyCar.Model = "Pinto"
strUser as string = "Me"
strPassword as string = "Secret"
Plus any code that has to do with a Car (a method or property) is contained in the Car object. So if you have your car object compiled into a Car.DLL you can upgrade it without re-compiling the application that uses it. Say a new law comes out requiring all cars to have detectors that automatically apply the brakes if the car in front is stopped. You can add a new property, HasAutoBrakes, to the object, compile the DLL, replace it and the old code will still work but any new code you write can take advantage of the new functionality.
VB6 Library
If I helped you then please help me and rate my post!
If you solved your problem, then please mark the post resolved
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|