This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

define new methods in DBMain

 
Himai Minh
Ranch Hand
Posts: 1328
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
May I add getRecords() to DBMain to load all database records?
Instruction.htlm doesn't say I can't.
Any recommends?
 
Roel De Nijs
Sheriff
Posts: 10593
141
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As far as I know you are not allowed to change the given interface. But you can of course create your own interface which extends the DBMain interface and define a few new methods. That's just fine. I would definitely not change the given interface.
 
Roberto Perillo
Bartender
Posts: 2271
3
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Roel De Nijs wrote:I would definitely not change the given interface.


Me neither. And welcome to JavaRanch!
 
Himai Minh
Ranch Hand
Posts: 1328
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks,guys.

interface MyDBMain extends DBMain { //declare new method signatures....}
class Data extends MyDBMain { //implements MyDBMain, DBMain methods.....}

Sounds valid?

Roberto buddy wrote an example like that in his paper.Just make sure as English is my second langugage. Thanks for your patience.
 
Roel De Nijs
Sheriff
Posts: 10593
141
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Himai Minh wrote:

interface MyDBMain extends DBMain { //declare new method signatures....}
class Data extends MyDBMain { //implements MyDBMain, DBMain methods.....}

Sounds valid?


That's a valid approach, but will not compile (classes don't extend interfaces)
 
Himai Minh
Ranch Hand
Posts: 1328
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Correction:
class Data implements MyDBMain {...}
Thanks.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic