home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!demos!news-server
- From: stas@itco.msk.su (Stas Strizhakov)
- Subject: Re: New try: Access to private constructor for building a private static member
- Date: Thu, 31 Dec 1992 06:52:14 GMT
- Reply-To: stas@itco.msk.su
- Organization: I.T. Co., Moscow, Russia.
- Sender: news-server@kremvax.hq.demos.su
- Message-ID: <ABUYfGheZA@itco.msk.su>
- Lines: 35
-
- In message <GIROD.92Dec23081920@node_262d6.tele.nokia.fi>
- Subject: [NEWS] New try: Access to private constructor for building a private static member
- girod@tele.nokia.fi (Marc Girod) writes:
-
- >class A {
- > private:
- > A();
- > static A a;
- >};
- ...
- >Are my compilers correct in refusing me the access to private
- >constructors, to build a private static member?
-
- Yes, it is correct, because private member functions, including constructors,
- can't be used out from class instance because of unvisibility. It is
- ideology of OOP. If you try to create private static member with private
- constructor, compiler will consider this as try to access private member
- function out from instance during startup code.
- So you should make the constructor with "public" access declaration.
-
- I think so.
- --
-
- Regards,
- Stas.
- ???????????????????????????????????????????????????????????????????????????????
- There's so many different worlds
- So many different suns
- Stas K. Strizhakov I.T.Co Programmer
- phone : (7-095)262-4381 fax : (7-095)924-3775
- e-mail : stas@itco.msk.su
-
-
-
-
-