home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!spool.mu.edu!howland.reston.ans.net!zaphod.mps.ohio-state.edu!news.acns.nwu.edu!network.ucsd.edu!sdcc12!sdcc8!cs163wav
- From: cs163wav@sdcc8.ucsd.edu (Anthony Minkoff)
- Newsgroups: comp.lang.c++
- Subject: HELP: How to typedef for private members?
- Message-ID: <43348@sdcc12.ucsd.edu>
- Date: 11 Jan 93 23:25:22 GMT
- Sender: news@sdcc12.ucsd.edu
- Organization: University of California, San Diego
- Lines: 35
- Nntp-Posting-Host: sdcc8.ucsd.edu
-
-
- I need to define a class with private members that are types created
- for this class. Since they are only needed for the class, the user
- should not know about them. E.g.:
-
- class Foo {
-
- public:
-
- Foo ( );
- ~Foo ( );
- /* etc */
-
- private:
-
- typedef struct {
- int one;
- int two;
- } two_ints;
-
- two_ints a;
-
- } ;
-
- The problem with the above code is that when I #include this header
- in a program, the program knows about the two_ints type. Is there
- any way to hide this type definition?
-
- An example of this situation might be a LinkedList class. The
- LinkedList class might use a node struct or class, but users of the
- LinkedList class would not need to know about or use nodes directly.
-
- Reponses in e-mail, please.
-
- Tony
-