Results 1 to 3 of 3
  1. #1

    Member Since
    Mar 08, 2010
    why classes and objects are similar in objective c
    I'm new to objective c.i got trough the point that objects and classes are same in objective c.i'm not getting this point how they can be same....

    i need the explaination....

    plzz reply mee......

  2. #2

    xstep's Avatar
    Member Since
    Jun 25, 2005
    On the road
    2011 MBP, i7, 16GB RAM, MBP 2.16Ghz Core Duo, 2GB ram, Dual 867Mhz MDD, 1.75GB ram, ATI 9800 Pro vid
    I'm not sure what you are asking. Typically a class is useless without being instantiated into an object. A few classes can be useful without creating an object.

    In object oriented languages, a class is a template for objects that will be based on it. You create objects by instantiating them from the class. The act of instantiating sets aside space for the variables you declared in the PERSON class, along with others that were inherited. So, if you have a PERSON class, you can create one or more PERSON objects (Frank, Kimberly, Jason) that use the model of PERSON. When you tell Frank to set his age to 32, you are using the method you wrote in the PERSON class, but it only affects age variable the Frank object. Kimberly and Jason have their own age variables.

    I can't think of a short way of describing this all, so I point you to the following...

    See Apples "The Objective-C Programming Language". On the left click on "Objects, Classes, and Messaging".

    "Becoming an XCoder" might be useful too. Search for class and object. Perhaps page 37.
    CameraTime - Time lapse photography for novice and advanced users.

    When asking questions, post the version of your software. You'll receive better answers.

    Please post your results to the thread as it is good feedback.

  3. #3

    Member Since
    May 10, 2010
    The above post is not quite correct and is confusing instances of objects and the concept of an object.

    A class IS an object. A class is just a way of denoting what the object is specifically. For instance if I said, "I have a thing." You know I have something but you don't know what. If I say, "I have a kitten." You know specifically what kind of thing I have. You don't know anything about a "thing" or what it might do but you do know a kitten will, probably, have fur and purr.

    In the most basic of terms objects are things that have methods and properties (I'll avoid the idea of events to keep it simple). Then can be told to do things and they can have values associated with them. The word object describes that idea of having properties and methods. By itself it is just a concept.

    A class then goes a step further and describes what kind of object a thing is, like a dog or a tree, and describes what methods and properties that object has. Like a dog might have a bark() method and a canBark property while a tree might have a shedLeaves() method and an isDeciduous property but a dog wouldn't shed leaves and trees don't bark; not even a dogwood.

    So far we've talked about the idea of things but we haven't talked about how you get a copy of this idea of an object, what is called an instance. When you instantiate a class you create a copy of an object of type class which can then be manipulated.

    Think of a class a blueprint. A blueprint is not a house itself but describes what a house should look like. When you build your house, when you instantiate it, you can then paint it, which is changing one of its properties, and you can turn on the airconditioner, which would be like using one of it's methods.

    So, to recap a class IS an object, it's just a specific description of a KIND of object, while an instance is a copy of a class that can be manipulated.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Classes on how to operate details
    By nancy Lee in forum OS X - Operating System
    Replies: 4
    Last Post: 07-05-2014, 12:20 AM
  2. iMovie Classes in SF Bay Area?
    By cjc182 in forum Movies and Video
    Replies: 3
    Last Post: 01-03-2012, 07:35 PM
  3. Fall classes
    By gagnerants in forum Schweb's Lounge
    Replies: 23
    Last Post: 09-01-2009, 08:20 AM
  4. To big for classes?
    By Periculum in forum Apple Notebooks
    Replies: 7
    Last Post: 08-27-2009, 01:09 PM
  5. Forgive Me, I'm A Switcher, No Classes
    By jearnest in forum Switcher Hangout
    Replies: 3
    Last Post: 04-20-2008, 04:00 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts