I'm having a bit of a problem. I have a virtual base class, call it part:
abstract class part {
part() {
doSomething();
}
abstract void doSomething();
}
I have a subclass, bolt, another class, location, is used in
doSomething.
public class bolt extends part {
public location lct=new location();
bolt() {
super();
}
public void doSomething() {
lct.bin( 22 );
doOtherStuff();
}
}
When I run this I get null pointer errors. It looks like
super is getting called before the new location() call gets
made. Is this correct? Is there a way to work around this?
I've considered doing my "new location" inside of doSomething
but that just doesn't feel right and is a bit confusing to
the reader.