The Artima Developer Community
Sponsored Link

Java Answers Forum
base class problem

2 replies on 1 page. Most recent reply: Mar 27, 2002 7:10 PM by Singh M.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 2 replies on 1 page
arun07001

Posts: 1
Nickname: arun07001
Registered: Mar, 2002

base class problem Posted: Mar 27, 2002 8:15 AM
Reply to this message Reply
Advertisement
Hi all,
I want to create a Helper class which basically delegate ( or thru inheritance ) all the methods to either DbHelper or GenHelper. But i really want one instance of Helper class so that i can declare all the varibale in it and DbHelper and GenHelper can access them.
If i use delegation then how do i acces these variables?
Whatz the way to do this with inheritance ??

thanks,
arun


Mohit Gupta

Posts: 15
Nickname: mohit
Registered: Mar, 2002

Re: base class problem Posted: Mar 27, 2002 9:25 AM
Reply to this message Reply
use static keywork for it, declare static variable in helper call and then access them with static getter methods.. may be it solve ur problem..as static variables are class spcific not instance specific

Singh M.

Posts: 154
Nickname: ms
Registered: Mar, 2002

Re: base class problem Posted: Mar 27, 2002 7:10 PM
Reply to this message Reply
Consider creating Helper as an interface and GenHelper, DBHelper implementing it. All the variables can be defined in Helper.

Flat View: This topic has 2 replies on 1 page
Topic: String array Previous Topic   Next Topic Topic: swing progress bar

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use