So, I tried to Google this but don't know what this kind of situation is called...
I'm working on my first use of class inheritance, where a parent class defines a set of methods and then several other classes extend that parent.
What I was wondering, is it possible to do something like this:
class foo {
private bar = false;
private baz = NULL;
}
Now let's say I have:
class foobar extends foo { }
I'd like to be able to have a condition in "foo" that says if any class extends "foo" and sets "bar = true" then "baz" must be set (ie. not null), or else throw an exception.
Is such a thing possible?