Topic: Return of private types from private member functions
Author: mas@ftel.co.uk (Mark Stubley)
Date: 1995/05/05 Raw View
Apologises if this subject has been covered here before. I have a
question regarding the accessability of private type declarations. For
the following code segment Sun C++ 4.0.1 produces the error:
"Foo.cc", line 9: Error (Anachronism): Foo::Bar is not accessible from file level.
class Foo
{
private:
enum Bar {a,b,c};
Bar baz();
};
Foo::Bar
Foo::baz()
{
return a;
}
"Foo.cc", line 9: Error (Anachronism): Foo::Bar is not accessible from file level.
As I only want to use th enum in a private context I would have
thought this was allowable. Could somebody please explain why the
standard has introduced this feature or is it something that has been
changed since Sun implemented their compiler ?
Thanks in advance
--
Regards,
Mark A. Stubley (mas@ftel.co.uk)
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
"I love deadlines. I like the whooshing sound they make as they fly
by." - Douglas Adams