Quote (Cattotonic @ Nov 6 2012 06:21pm)
Okay, I've stuck it under the Player (parent) class and labeled it protected. But my question is would it be instantiated officiallysince abstract classes can't have constructors? The Computer (child) class will have it instantiated when a Computer is constructed, but not the Human.
Bolded statement is false.
1.
All classes in java have at least one constructor.
2. If you do not specify a constructor, a no args constructor is automatically generated for you.
3. if you do not specify which constructor to chain off from in the first line of your constructor (eg: this(...) or super(...)), then super() is automatically inserted for you, which calls your direct superclass's no-args constructor
You're confused since you cannot instantiate an abstract class. But rest assured, it has a constructor. Your Computer and Human class constructors are both invoking it.
This post was edited by carteblanche on Nov 6 2012 04:33pm