Newbie class question

C

C.T. Matsumoto

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

matt.smillie

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top