LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-29-2002, 11:43 AM   #1
aashishagrawal
LQ Newbie
 
Registered: Jun 2002
Posts: 4

Rep: Reputation: 0
Lightbulb changing access level in Inheritance


Pl see the following code-
class A
{
public:
void show(){cout<<"hello"<<endl;}
};
class Bublic A
{
private:
A::show;
};
main()
{
B b;
b.show();// should be an error
}

now when i try to access show direclty from a B obj in main
this should give error, as I have changed its access for
class B to private.
( as per C++ FAQ http://vision.eng.shu.ac.uk/C++/c++/...heritance.html),
but the above piece of code works fine with
Linux/gcc/g++,
any help to understand this is appriciated.

Thanks
Aashish
 
Old 12-03-2002, 07:23 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
If you are referring to (and I assume you are)

24.6 What are the access rules with private and protected inheritance?

then you have done it the wrong way round :}

If g++ compiles this without troubles it's doing just well.

Cheers,
Tink

p.s.: the C++ - Faq's official address is C++ - Faq
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
changing init level h3htimo Linux - Newbie 5 10-24-2005 11:05 PM
Changing Permission - Root Level? Garoth Linux - Software 4 02-24-2005 07:54 PM
Changing Fedora RUN LEVEL 3? carlosinfl Fedora 5 01-29-2005 06:07 PM
higher access level for a user? herc Linux - General 2 12-29-2003 10:50 AM
low level hardware access herambshembekar General 3 03-25-2002 12:12 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:42 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration