• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

nested class extends enclosing class

 
Ranch Hand
Posts: 1392
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In this example, class A has 3 members, a field x, a method m and a nested class B. Since B extends A, B inherits the field x and the method m. x and m are members of B.
B is a member of A. Since B extends A, is B a member of B?
 
Ranch Hand
Posts: 1873
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Since B extends A, is B a member of B?
yes. why is the confusion?
also, why one would need such functionality where "a member EXTENDS the container class"...
have you come across such an example?
regards
maulin
 
Maulin Vasavada
Ranch Hand
Posts: 1873
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
also,
run the following code to see what could go wrong if we mess up..

outcome? goes into infinite loop
regards
maulin
 
Marlene Miller
Ranch Hand
Posts: 1392
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you Maulin for showing me how the code goes into an infinite loop. That is good to know.
I was have trouble trying to understand how a class declared in an interface could implement the interface. I think I made the problem worse by changing the interface to a class.
Thank you for your time. Marlene
 
reply
    Bookmark Topic Watch Topic
  • New Topic