Newbie class question

Discussion in 'Ruby' started by C.T. Matsumoto, Feb 19, 2006.

  1. Hi

    I've been trying to get my head around the rules for making classes. One
    question I have is whether a class must be initialized. Or can a class
    just hold data without taking an argument.

    --
    Posted via http://www.ruby-forum.com/.
     
    C.T. Matsumoto, Feb 19, 2006
    #1
    1. Advertisements

  2. C.T. Matsumoto

    Guest

    An initialised class (if I guess your meaning correctly) is called an
    object or an instance.

    Classes don't have to be initialised to hold data or methods, but from
    a design perspective class methods and instance methods are used for
    different things. A class is usually a generic category, and an
    instance of that class represents a particular object in that category.
    For instance, "Car" might be a class, and "my VW Jetta" would be an
    instance of it. Generally, most methods will likely be instance
    methods, since it's instances that you're usually interested in.

    Post an example of what you're trying to do - you'll likely get more
    concrete advice.
     
    , Feb 19, 2006
    #2
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. E11
    Replies:
    1
    Views:
    5,781
    Thomas Weidenfeller
    Oct 12, 2005
  2. Snoeys Andy
    Replies:
    2
    Views:
    573
    White Wolf
    Sep 12, 2003
  3. christopher diggins
    Replies:
    16
    Views:
    1,061
    Pete Becker
    May 4, 2005
  4. Joseph Turian
    Replies:
    5
    Views:
    868
  5. SzH
    Replies:
    1
    Views:
    468
  6. Christian Maier
    Replies:
    3
    Views:
    643
    John Harrison
    Feb 15, 2007
  7. zalek
    Replies:
    6
    Views:
    430
    Roedy Green
    Jul 12, 2008
  8. Jerry C.
    Replies:
    8
    Views:
    586
    Uri Guttman
    Nov 23, 2003
Loading...