Objects

D

Danny

Hi

After reading alot of literature on C++ i have failed to find a
reasonable definition of a class and an object, could someone provide these?
 
K

Karl Heinz Buchegger

Karl said:
If you read some literature, then surely you have some specific questions
instead of the global one. The point is: talking about classes and objects,
how to use them, what to do with them is a fairly lengthy topic.

Forget this part. I misread your question the first time.
 
E

E. Robert Tisdale

Danny said:
After reading alot of literature on C++,
I have failed to find
a reasonable definition of a class and an object,
could someone provide these?

In the context of the C++ computer programming language,
a class (struct) is a User Defined Type (UDT) and
an object is an instance of type --
either a built-in type or a UDT.
 
J

Jack Klein

In the context of the C++ computer programming language,
a class (struct) is a User Defined Type (UDT) and
an object is an instance of type --
either a built-in type or a UDT.

Close, but no cigar...


The word has an exact, precise, and specific definition in the ISO C++
standard:

1.8 The C++ object model

"An object is a region of storage."

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++ ftp://snurse-l.org/pub/acllc-c++/faq
 
E

E. Robert Tisdale

Jack said:
The word has an exact, precise, and specific definition in the ISO C++
standard:

1.8 The C++ object model

"An object is a region of storage."

It's more *specific* but I'm not so sure that it's *precise*.
It seems to indicate that objects are *data objects*
in the context of a C++ program but objects may exist
even if no storage is actually allocated for them.
For example, objects declared to hold temporary intermediate values
may be elided:

double work(double mass, double acceleration, double distance) {
float_t force = mass*acceleration;
return force*distance;
}
 
D

David T. Croft

The use of terminology is not always consistent. A class describes an
object and than the description (the class) is used to construct the
object. A class is like a mold used for making objects.
 

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
474,139
Messages
2,570,805
Members
47,351
Latest member
LolaD32479

Latest Threads

Top