Results 1 to 3 of 3

Thread: Objects

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Oct 2010
    Posts
    16

    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.

  2. #2
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Jefferson City, MO
    Posts
    9,897

    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.
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

  3. #3
    Frenzied Member
    Join Date
    Jan 2010
    Location
    Connecticut
    Posts
    1,687

    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
  •  



Click Here to Expand Forum to Full Width