A class can extend only one other class into itself. If I wanted to extend more than one class I have to use an interface. My teacher hasn't really gone over it too much so I'm asking you guys. How would I make an interface that would have extend 3 other classes into itself?
USELESS
class soandso inherits foo,bar.
Is that what you need?
quote:
Alidane wrote this then went back to looking for porn:
class soandso inherits foo,bar.
... except you can't do that in java, because it doesn't support multiple inheritance.
The best way to accomplish the task is to make an instance variable for each class you are "inheriting". It's not that much more cumbersome.
There is no way to leverage interfaces to allow you to inherit more than one class.
Iulius Czar fucked around with this message on 12-08-2004 at 02:52 PM.
[edit] So how'd your test go?
Oh well I still did well. I couldn't get a custom exception to work. I extended RuntimeException but it wouldn't catch an ArrayOutofBoundsException so I just commented the catch out and put a 'catch (Exception e)'.
quote:
A sleep deprived Iulius Czar stammered:
[QB]... except you can't do that in java, because it doesn't support multiple inheritance.
In my defense, I'd just woken up and I haven't written any Java code in over six months...haha. Next quarter's gonna hurt.