Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Sep 2nd, 2005, 3:57 AM   #1
jonyzz
Programmer
 
jonyzz's Avatar
 
Join Date: Aug 2005
Location: null
Posts: 40
Rep Power: 0 jonyzz is on a distinguished road
Question What is Lightweight C++? difference in inner classes between C++ and Java?

I read in a Lightweight C++ tutorial (what is Lightweight C++ ??) that an inner class in C++ does not have access to the members of its enclosing class. Is that right?
Second I read about inner classes in Java - i understood that they have access to their enclosing class' members (is that always?). And I feel like inner classes in Java are used as an analogy of friend classes in C++.
What do you think?
jonyzz is offline   Reply With Quote
Old Sep 2nd, 2005, 6:45 AM   #2
tempest
Programming Guru
 
tempest's Avatar
 
Join Date: Oct 2004
Posts: 1,041
Rep Power: 5 tempest is on a distinguished road
Send a message via ICQ to tempest Send a message via AIM to tempest Send a message via Yahoo to tempest
A subclass has access to all the public members of its inherited class.
__________________

tempest is offline   Reply With Quote
Old Sep 2nd, 2005, 6:49 AM   #3
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Investigate the meaning of the keywords, "public", "private", and "protected." That said, "Lightweight C++" is what I write .
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Sep 2nd, 2005, 7:53 AM   #4
grumpy
Programming Guru
 
grumpy's Avatar
 
Join Date: Jun 2005
Location: Adelaide, South Australia
Posts: 1,223
Rep Power: 5 grumpy is on a distinguished road
Quote:
Originally Posted by jonyzz
I read in a Lightweight C++ tutorial (what is Lightweight C++ ??)
Lightweight C++ is presumably the name of the tutorial.
Quote:
Originally Posted by jonyzz
that an inner class (sometimes referred to as s nested class, but a more accurate description is "a class declared within the scope of another class") in C++ does not have access to the members of its enclosing class. Is that right?
Almost. An inner class has access to public members of it's enclosing class. It does not have access to protected to public members.
Quote:
Originally Posted by jonyzz
Second I read about inner classes in Java - i understood that they have access to their enclosing class' members (is that always?). And I feel like inner classes in Java are used as an analogy of friend classes in C++.
What do you think?
That's not my understanding, but then I know less about the nitty gritty of Java than I do of C++.

My understanding of inner classes in Java is that they are similar in nature to such classes in C++.
grumpy is offline   Reply With Quote
Old Sep 2nd, 2005, 9:56 AM   #5
jonyzz
Programmer
 
jonyzz's Avatar
 
Join Date: Aug 2005
Location: null
Posts: 40
Rep Power: 0 jonyzz is on a distinguished road
thank you for your explanations guys
jonyzz is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 2:10 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC