Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Inheritance problem

 
Chaturaka Gunatilaka
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


I want to get the output as "Toyota Corolla 2000000 2001".But there is something wrong.What is it?Thank you.
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the problem is shadowing
either explicitly mention super class's variable as in


or

 
fred rosenberger
lowercase baba
Bartender
Posts: 12266
36
Chrome Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Chaturaka Gunatilaka wrote:I want to get the output as "Toyota Corolla 2000000 2001".But there is something wrong.What is it?Thank you.

Generally, to posts like this, I'd reply with "How do you know something is wrong?"

Folk around here aren't mind readers. We don't know what you think is wrong. If I were to compile and run this, I'd take a look and see the code is doing exactly what it is supposed to do. I could GUESS what you think is wrong, but it would only be a guess.

Your job, when you post here, it to make it EASY for us to help you. You may want to look at some of the articles here, especially the one called TellTheDetails.

thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic