Re: [Dev-C++] Off:Classes Access Restrictions
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: B. <ama...@uo...> - 2002-10-29 12:12:09
|
Thank you, Sir, but what is written in their main.cpp file? Remember: tha=
t
groups, dummies, nerds, and badboys, are only symbolic names. There is no=
thing
set up telling for the class that one or other is accessing it.
Regards,
Andr=E9
=3D=3D=3D
Daniel Glenfield wrote:
> Are you saying that you will create objects of the class, named Dummies=
,
> Nerds, and BadBoys and limit their access?
>
> I might suggest using overloaded constructors and setting a member vari=
able
> (a bool) to TRUE when used. For example, you have three overloaded
> constructors.
>
> any (DummyAccess =3D true);
> any (DummyAccess =3D true, NerdAccess =3D true);
> any (DummyAccess =3D true, NerdAccess =3D true, BadBoysAccess =3D true)=
;
>
> Then in the member functions
>
> void any::very_important_func3( any &ConstructedObject )
> {
> if (ConstructedObject.NerdAccess !=3D true)
> {
> return 0; // escape from the function
> }
> //... Do something
> }
>
> What about that?
>
> >From: Andr=E9 Mac=E1rio Barros <ama...@uo...>
> >To: Dev-C++ Mailing List <dev...@li...>
> >Subject: [Dev-C++] Off:Classes Access Restrictions
> >Date: Mon, 28 Oct 2002 23:06:15 -0200
> >
> >Gentelmen,
> >
> > Sorry about the off-topic question, but let me know if you can hel=
p:
> >
> > 1. Consider the following Class
> > Class any{
> > public:
> > any (int x=3D0, int y=3D0, int z=3D0);
> > void dummy_func1();
> > void not_so_dummy_func2();
> > void very_important_func3();
> > void only_for_bad_boys_func4();
> > private:
> > int x;
> > int y;
> > int z;
> > };
> >
> > 2. Let suppose 3 different groups of users (supose programmers):
> > "The dummies", "The Nerds", and "The Bad Boys"
> >
> > 3. I want to restrict the access to the public functions by group,
> >that is, dummies programs only accessing func1, nerds programs accessi=
ng
> >func1 to func3, and badboys programs accessing all the functions;
> >
> > 4. Is it possible do this, step 3, in C++?
> >
> > 5. If item 4 is possible, is it possible in Dev-C++? How?
> >
> >Regards
> >Andr=E9
> >
> >
> >
> >
> >
> >
> >-------------------------------------------------------
> >This sf.net email is sponsored by:ThinkGeek
> >Welcome to geek heaven.
> >http://thinkgeek.com/sf
> >_______________________________________________
> >Dev-cpp-users mailing list
> >Dev...@li...
> >TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm
> >https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
> _________________________________________________________________
> Unlimited Internet access for only $21.95/month. Try MSN!
> http://resourcecenter.msn.com/access/plans/2monthsfree.asp
|