Hi Craig,
> In Java interfaces it is possible to define static final fields (and assign
> values to them) - these fields provide constants that can be exploited by all
[quoted text clipped - 11 lines]
> into problems through mutiple inheritance (I want to extend X but would also
> like to inherit the constants in Y)
in Java these interface are mostly used like enums in C#/.NET.
You may try this pattern, if your consts are of integral type:
// the value doesn't care at all
public enum SomeName {
Foo,
Bar
}
or
// you need a special value, i.e. to pass them
// to an unmanaged resource, etc.
public enum SomeName {
Foo = 17,
Bar = 1
}
or
// values can be combined with the OR operator
[Flags]
public enum SomeName {
Read = 0,
Write = 2,
Execute = 4
}
if you need to deal with several type:
public sealed class Foo {
public const string Bar = "whatever";
public const int SomeInt = 1;
....
private Foo() {
// prohibit instances
}
}
bye
rob