Re: [Dev-C++] C++ standard - Nesting classes.
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Jason H. <jas...@bt...> - 2001-09-26 15:32:45
|
Thanks for that. I don't currently have any other compilers on my system so
hadn't thought to check. I know that the Borland Compiler is probably the
most standard compliant compiler available, so the fact that it didn't work
on it probably meens it is standard.
I guess I'll have to inquire of the MinGW development community to see about
them adding compliance. Thinking of all this I remember hearing about a
website that contains a copy of the C++ standard, does anyone know where it
it? I will be searching for it, but it would be easier if somebody already
knows about it.
Thanks, Jason.
----- Original Message -----
From: "Ioannis Vranos" <no...@ya...>
To: <dev...@li...>
Sent: Wednesday, September 26, 2001 1:11 PM
Subject: RE: [Dev-C++] C++ standard - Nesting classes.
You are right. The following code compiles in Dev-C++:
class A
{
public:
enum errors{ MEMORY, DISK, MONITOR};
private:
class E
{
errors e;
public:
E(errors er):e(er) {}
};
};
int main()
{
A a;
A::errors e;
A::E x(e); // Mistake, E is private
}
This shouldn't compile, so i consider it a compiler defect. Borland C++
5.5 gives the (expected) error:
Error E2247 temp.cpp 23: 'A::E' is not accessible in function main()
*** 1 errors in Compile ***
Ioannis
* Ioannis Vranos
* Programming pages: http://www.noicys.f2s.com
* Alternative URL: http://run.to/noicys
> -----Original Message-----
> From: dev...@li...
> [mailto:dev...@li...] On Behalf
> Of Jason Hardman
> Sent: Wednesday, September 26, 2001 4:03 AM
> To: Dev-C++
> Subject: [Dev-C++] C++ standard - Nesting classes.
>
>
> Hi,
>
> In a project I have been working on I have nested some
> classes within a main class that provides an overall
> functionality. I wanted to make these internal classes
> inaccessible to anyone using the main class. I had hoped that
> putting them in a private or protected area of the main class
> it would stop outside access, but this doesn't seem to work
> in Dev-C++ (MinGW). Does anyone know if that is standard C++
> behaviour? None of my C++ books say anything about access
> specifiers and nested classes, and they say pretty little
> about nested classes full-stop. It could reasonally be that
> only data and methods are affected by access specifiers, but
> it's hard for me to be sure.
>
> I am now looking for an alternative way of hiding those
> classes, although I have found some interesting options in
> using an implementation namespace, I am still interesting in
> hearing any other ideas?
>
> Thanx, Jason.
>
>
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
_______________________________________________
Dev-cpp-users mailing list
Dev...@li...
https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
|