Having trouble distinguishing between a "Class" and a "Object"

Started by
13 comments, last by chadsxe 17 years, 1 month ago
Quote:Original post by chadsxe
I can't even distinguish a "Class" from a "Object".

A class defines a data type: a set of values and operations on them.
An object is simply one of those defined values.

Although not technically correct, it might help you to think of "int" as a class.

set of values: ranging from -2,147,483,648 to 2,147,483,647
operations: add, subtract, multiply, divide, modulo, bitwise and/or/xor...

An object of that class could be 7, or 435, or -13

Quote:Original post by chadsxe
So for example lets use oh I don't know a Bank to try and give examples.

You have to ask yourself: what is it that defines a Bank in the context that you're interested in? Dou you want to store information about customers (financial context) or information about when it was built (historical context).. or maybe insurance data (for an insurance agency)?
Advertisement
Quote:
Although not technically correct, it might help you to think of "int" as a class.


The OP didn't specify a language, and in some OO languages (Ruby and Smalltalk are 2 I know of ) integers have classes and integer literals are objects.
Quote:Original post by rip-off
Quote:
Although not technically correct, it might help you to think of "int" as a class.

The OP didn't specify a language, and in some OO languages (Ruby and Smalltalk are 2 I know of ) integers have classes and integer literals are objects.

Right, but beginners apparently insist on learning C++ instead of nice languages, because OMG C++ is 10 times faster or something along those lines... ;)
Go with Promit's answer [wink]
----------------------------------------Now just hit that link that says 'Rate This User' [wink]
Sometimes it is besides why sources are so cryptic. Thanks for the info everyone. It makes a lot more sense hearing it from this forum.

Regards

Chad

This topic is closed to new replies.

Advertisement