• 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

class

 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is a class subclass of itself?
 
Desperado
Posts: 3226
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Not in Java.
 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The complete reference by Patrick Naughton says it is - ie. every class is a sub class of itself. Only a "strict" sub class of a class cannot include itself.
 
Wanderer
Posts: 18671
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Different people in OOP have slightly different definitions of "subclass", but in this case the definition Naughton uses is not the one used in Java. The JLS has a precise definition of subclass which does not include the class itself - only other classes which are extended from it, and their "descendents". If you see the word "subclass" on the exam, you can assume this is the definition used.
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Jim Yingst:
Different people in OOP have slightly different definitions of "subclass", but in this case the definition Naughton uses is not the one used in Java. The JLS has a precise definition of subclass which does not include the class itself - only other classes which are extended from it, and their "descendents". If you see the word "subclass" on the exam, you can assume this is the definition used.


Thanks! All for replying.
 
reply
    Bookmark Topic Watch Topic
  • New Topic