Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Newbie class question

Reply
Thread Tools

Newbie class question

 
 
C.T. Matsumoto
Guest
Posts: n/a
 
      02-19-2006
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/.


 
Reply With Quote
 
 
 
 
matt.smillie@gmail.com
Guest
Posts: n/a
 
      02-19-2006
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.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Simple Newbie question about accessing a Variable out of a class of a class Christian Maier C++ 3 02-15-2007 08:24 AM
Class A contains class B, class B points to class A Joseph Turian C++ 5 12-30-2005 03:24 PM
Nested Class, Member Class, Inner Class, Local Class, Anonymous Class E11 Java 1 10-12-2005 03:34 PM
A parameterized class (i.e. template class / class template) is not a class? christopher diggins C++ 16 05-04-2005 12:26 AM
Newbie Question: Function of a class keeps "forgetting" data thats declared inside class Snoeys Andy C++ 2 09-12-2003 06:15 PM



Advertisments