home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!elroy.jpl.nasa.gov!usc!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!bu.edu!cvbnet!cvbnet.prime.com!skochhar
- From: skochhar@cvbnet.prime.com (Sandeep Kochhar x4618 5-2)
- Newsgroups: comp.lang.c++
- Subject: Nested Class constructors
- Message-ID: <3855@cvbnetPrime.COM>
- Date: 10 Sep 92 17:18:53 GMT
- Sender: postnews@cvbnetPrime.COM
- Distribution: usa
- Organization: Computervision
- Lines: 35
-
- hi!
- Suppose I have a header file that contains:
- class B { public: B(); };
- class A { class B { public: B(); }
- public: A(); };
-
- In the implementation file, how to I declare and define the two constructors?
- For the global B class, I try
- B::B() {...}
- and on my Sun C++ 2.1, I get:
- "nest.c", line 26: error: B() is not a member of B
-
- For the nested B class, I tried
- A::B::B() {...}
- but I got a message saying
- "nest.c", line 26: sorry, not implemented: class names do not nest,
- use typedef x::y y_in_x
- So, I tried,
- typedef A::B BinA;
- BinA::B() {...};
- but I got
- "nest.c", line 27: undefined structure or union
-
-
- So, again, my question is:
- In the implementation file, how to I declare and define the two constructors?
-
-
- Thanks.
-
- --
- Sandeep Kochhar
- Computervision, MS 5-2 email: skochhar@cvbnet.prime.com
- 14 Crosby Drive tel: (617) 275-1800 x 4618
- Bedford, MA 01730 fax: (617) 275-8506
-