public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c++/6675: C++: derived class cannot acccess protected members of base class
@ 2002-05-19  9:23 paolo
  0 siblings, 0 replies; 2+ messages in thread
From: paolo @ 2002-05-19  9:23 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, nobody, thomas

Synopsis: C++: derived class cannot acccess protected members of base class

State-Changed-From-To: open->closed
State-Changed-By: paolo
State-Changed-When: Sun May 19 09:23:09 2002
State-Changed-Why:
    Closed on submitter's request.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=6675


^ permalink raw reply	[flat|nested] 2+ messages in thread

* c++/6675: C++: derived class cannot acccess protected members of base class
@ 2002-05-16  5:46 thomas
  0 siblings, 0 replies; 2+ messages in thread
From: thomas @ 2002-05-16  5:46 UTC (permalink / raw)
  To: gcc-gnats

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1470 bytes --]


>Number:         6675
>Category:       c++
>Synopsis:       C++: derived class cannot acccess protected members of base class
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Thu May 16 05:46:04 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Thomas Koeller
>Release:        3.0.4
>Organization:
>Environment:
System: Linux sarkovy.koeller.dyndns.org 2.4.18 #3 Sam Mär 23 01:29:53 CET 2002 i686 unknown
Architecture: i686

	
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: /home/thomas/src/gnu/gcc-3.0.4/configure --prefix=/opt/gcc-v3 --enable-shared --with-gnu-as --with-gnu-ld --enable-threads=posix --enable-languages=c,c++ --with-system-zlib
>Description:
	The program below does not compile, although it is legal. Since class 'Derived'
	is derived from 'Base' and consequently should be granted access to its protected
	members, the compiler complains about member 'X' being protected.

class Base
{
  protected:
    int X;
};

class Derived : public Base
{
  public:
  int Get(void) const;
  int Get(const Base & cl) const;
};

int
Derived::Get(void) const
{
  return X;
}

int
Derived::Get(const Base & cl) const
{
  return cl.X;
}

>How-To-Repeat:
	Compile the program above.
>Fix:
	Workaround: make base class member public
>Release-Note:
>Audit-Trail:
>Unformatted:


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-05-19 16:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-05-19  9:23 c++/6675: C++: derived class cannot acccess protected members of base class paolo
  -- strict thread matches above, loose matches on Subject: below --
2002-05-16  5:46 thomas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).