• Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem accessing method defined in sub class  RSS feed

 
Dilip kumar
Ranch Hand
Posts: 360
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All,

Hope I'm not confusing with my question and code. Really appreciate any suggestions. Thanks

class ReportAction


class ReportDAO


class Download


class DownloadDataBean extends ReportDataBean
 
Deva Sagar
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You'll need to explicitly cast the returned object to a DownloadDataBean -



if you're not certain that you will always get a DownloadDataBean back, you should also use an instanceof check to avoid a ClassCastException:


If your getReportDataBean() _always_ returns a DownloadDataBean, you might want to consider changing the return type so that every caller does not have to cast it.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!