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. Advertising

  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. Advertising

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:
    4,720
    Thomas Weidenfeller
    Oct 12, 2005
  2. Snoeys Andy
    Replies:
    2
    Views:
    409
    White Wolf
    Sep 12, 2003
  3. christopher diggins
    Replies:
    16
    Views:
    738
    Pete Becker
    May 4, 2005
  4. Joseph Turian
    Replies:
    5
    Views:
    579
  5. Christian Maier
    Replies:
    3
    Views:
    493
    John Harrison
    Feb 15, 2007
Loading...

Share This Page