home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!ogicse!uwm.edu!ux1.cso.uiuc.edu!news.cso.uiuc.edu!meibm31.cen.uiuc.edu!pl2440
- From: pl2440@meibm31.cen.uiuc.edu (Paul Jay Lucas)
- Newsgroups: comp.lang.c++
- Subject: Re: Simple question: class objects & pointers
- Message-ID: <Bxu2zr.F1q@news.cso.uiuc.edu>
- Date: 17 Nov 92 00:07:02 GMT
- Article-I.D.: news.Bxu2zr.F1q
- References: <1992Nov16.162130.11475@cis.ohio-state.edu>
- Sender: usenet@news.cso.uiuc.edu (Net Noise owner)
- Distribution: usa
- Organization: University of Illinois at Urbana
- Lines: 23
-
- In <1992Nov16.162130.11475@cis.ohio-state.edu> beery@clipper.cis.ohio-state.edu (brian david beery) writes:
-
- >I am new to C++, and have a question regarding pointers and class objects:
- >The following code:
- >class cl_object
- >{public:
- > int value;
- >}
- >generic_function(cl_object *o)
- >{
- > *o.value=0;
- >};
-
- o->value = 0; // shorthand for: (*o).value = 0;
-
- Look at the precedence of * and . (dot). If you don't have
- one, I'd suggest a good C++ book.
-
- BTW, public data are considered bad by some people.
- --
- - Paul J. Lucas University of Illinois
- AT&T Bell Laboratories at Urbana-Champaign
- Naperville, IL pjl@cs.uiuc.edu
-