Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Object reference not able to understand!  RSS feed

 
Raga Jana
Ranch Hand
Posts: 35
Google Web Toolkit Java PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a doubt in inheritance . Even though i referred online tutorials, i'm not able to understand the concpet. Could any one make me clear??



Why we have to create a object like a above?? What's the use??
 
Sunny Bhandari
Ranch Hand
Posts: 448
Eclipse IDE Firefox Browser Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The last line should be



Read a good book than online tutorials...
 
Anooj Narvekar
Greenhorn
Posts: 10
IntelliJ IDE Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please check the syntax of the sample code you've pasted
 
Lalit Mehra
Ranch Hand
Posts: 384
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you cannot create an object of the PARENT class and refer to it using a REFERENCE variable of CHILD class ...

please re-read where you read from ...

 
Raga Jana
Ranch Hand
Posts: 35
Google Web Toolkit Java PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes i misplaced the syntax.. What you said (Mehra) is right!
 
Lalit Mehra
Ranch Hand
Posts: 384
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
your welcome ...
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!