[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Interfaces have no variables (was: Re: [Gzz] PEG ``vob_bgvob--humppa
From: |
Tuomas Lukka |
Subject: |
Re: Interfaces have no variables (was: Re: [Gzz] PEG ``vob_bgvob--humppake``: Background Vob interface) |
Date: |
Thu, 6 Mar 2003 09:24:31 +0200 |
User-agent: |
Mutt/1.4i |
On Wed, Mar 05, 2003 at 09:55:16PM +0200, Alatalo Toni wrote:
> On Wed, 5 Mar 2003, Benja Fallenstein wrote:
>
> > > public boolean drawBorder = true;
> > Interfaces cannot have variables. The effect of this line is a constant
> > 'drawBorder' with value 'true.'
>
> this is probably totally unrelated, but just a sidethought:
> does it ever make sense to have (such) constants in an interface?
Quite often, for the same reason as you have enums in C/C++:
public interface Foo {
int CRUNCHY = 1;
int CHEWY = 2;
int NUTRITIOUS = 4;
Bar getSnack(int type);
}
where you'd then call
foo.getSnack(foo.CHEWY | foo.NUTRITIOUS);
Tuomas
- [Gzz] PEG ``vob_bgvob--humppake``: Background Vob interface, Asko Soukka, 2003/03/05
- Re: [Gzz] PEG ``vob_bgvob--humppake``: Background Vob interface, Benja Fallenstein, 2003/03/05
- Re: [Gzz] PEG ``vob_bgvob--humppake``: Background Vob interface, Benja Fallenstein, 2003/03/05
- Re: [Gzz] PEG ``vob_bgvob--humppake``: Background Vob interface, Asko Soukka, 2003/03/05
- Re: [Gzz] PEG ``vob_bgvob--humppake``: Background Vob interface, Benja Fallenstein, 2003/03/06
- Re: [Gzz] PEG ``vob_bgvob--humppake``: Background Vob interface, Tuomas Lukka, 2003/03/06