Re: Objects

From: Robert Fortune (catlike1_at_earthlink.net)
Date: 11/06/03


Date: Thu, 06 Nov 2003 10:23:21 GMT


"Robert Fortune" <catlike1@earthlink.net> wrote in message
> news:EFeqb.11550$Oo4.6831@newsread1.news.atl.earthlink.net...

> > Is an object a class and a class an object?

Mike Wahler" <mkwahler@mkwahler.net> wrote in message
news:OIeqb.1997$Z25.1993@newsread4.news.pas.earthlink.net...

> No.
>
> A 'class' defines a data type. An object is
> an instance of a type.
>
> int i; /* defines an instance (an object) of type 'int', named 'i' */
>
> class X /* defines the type 'X' */
> {
> int member;
> };
>
> X obj; /* defines an instance (an object) of type 'X', named 'obj'
>
> What C++ book(s) are you reading?
>
Mike,

Thanks again everyone for your answers. You make this
group great!

   Sams Teach Yourself C++ Programming in 21 days by
Jesse Liberty. I like this book. It's helping me get my foot
in the door. Aside from this it's really a good book.

   What's confusing:

 "A Class is just a collection of variables -- often of different types --
combined with a set of related functions."

Ok. I follow that. (and old QB programmer here)

then:

  "A Class enables you to encapsulate, or bundle, these
various parts and various functions into one collection, which is called an
object."

He seems to be saying that a collection of data members
and related functions is an object as well as a class.

-Robert