🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #1432

Re: Proposal for default scope

#1432
From: Donald W. Rouse II
Date: Fri, 08 Jan 1993 17:36
29 lines
1615 bytes
In article <1993Jan8.044714.2027@qualcomm.com> greg@qualcom.qualcomm.com (Greg Noel) writes:
[...]
>The semantics would be that all names defined in the scope would be visible
>within the scope (subject to the usual scoping/visibility rules, of course);
>names that were declared in the class description would be the only ones
>exported from the scope.  This would allow a helper function to be defined
>that had full access to the class private members, but still be type-safe,
>since the only way to access the helper functions would be from within the
>scope and the only way to enter the scope would be via the class interface.
>
>That is,
>	class Class {
>	public:  int func1();
>	};
>	Class:: {
>		int helper() { /* ... */ }
>		int func1() { /* code including calls to helper() */ }
>	}
>Since helper() is not declared in the class, it is not exported from the
>scope, while func1() is declared in the class, so it is exported in the
>normal fashion.
>

You can accomplish the same thing with
	class Class {
	private: static int helper ();
	public:  int func1();
	};
although you don't get the syntactic sugar.
Technical Details
Message-ID: <1993Jan8.173654.1189@cci632.cci.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!caen!destroyer!gatech!darwin.sura.net!udel!rochester!rit!cci632!dwr
References: <mkohtala.726108774@vipunen.hut.fi> <1993Jan8.044714.2027@qualcomm.com>

Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c++
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!caen!destroyer!gatech!darwin.sura.net!udel!rochester!rit!cci632!dwr
From: dwr@cci632.cci.com (Donald W. Rouse II)
Subject: Re: Proposal for default scope
Message-ID: <1993Jan8.173654.1189@cci632.cci.com>
Organization: [Computer Consoles, Inc., Rochester, NY
References: <mkohtala.726108774@vipunen.hut.fi> <1993Jan8.044714.2027@qualcomm.com>
Date: Fri, 8 Jan 1993 17:36:54 GMT
Lines: 29