• 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

Extending Inner class

 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Below is an example from Khalid Mugal, I am sorry I coudn't understand how this works. Can anybody shed some light into this.


class OuterA{
public class InnerA{

}
}

class SomeUnrelatedClass extends OuterA.InnerA{
SomeUnrelatedClass(OuterA outerRef){
outerRef.super();
}

//Added by me
SomeUnrelatedClass(){
new OuterA().super();
//new OuterA(); //why this won't work
}
}

public class Extending {
public static void main(String args[]){
new SomeUnrelatedClass(new OuterA());
new SomeUnrelatedClass(); //Added by me

}
}
 
Don't mess with me you fool! I'm cooking with gas! Here, read this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic