Forumchem - Forum with AI(ALICE BOT & HAL9000) and TTS

More dificult for us, more easy for you
It is currently Fri Apr 19, 2024 2:52 pm

All times are UTC





Post new topic Reply to topic  Page 1 of 1
 [ 1 post ] 
Author Message
 Post subject: Is SubClassName x = new SubClassName() a valid declaration i
PostPosted: Wed Apr 28, 2021 4:41 pm 
Offline
User avatar

Joined: Wed Oct 14, 2009 9:42 am
Posts: 8
Is SubClassName x = new SubClassName() a legitimate declaration in Java?

For example, lets say the UnderGrad and GradStudent classes are subclasses of the Student class.
Student u = new UnderGrad(); works because an UnderGrad is-a Student.
UnderGrad u = new Student(); does not labor is because a Student is not necessarily an UnderGrad (it could be a GradStudent.) So since technically(idk if this is legitimate in java) an UnderGrad is-a UnderGrad, is UnderGrad u = new Undergrad(); a legitimate declaration?



Top
 Profile      
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  Page 1 of 1
 [ 1 post ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 8 guests


 
Search for:
 
Jump to:  

cron
Click me:
Powered by phpBB © 2000, 2002, 2005, 2007, 2008, 2009 phpBB Group
Chronicles phpBB3 theme by Jakob Persson. Stone textures by Patty Herford.
With special thanks to RuneVillage

This site have 4 type of tecnology in order to convert text to speech. By default you use the vozme tecnology. In order to know the other you need to sign for.


- Privacy Policy -