posted 23 years ago
Doug,
It appears that only a portion of the code From RHE appeared in your posting. You ask "How can I print the variables that are in Base2 so I can see what is happening?" But the way Base2 is defined in your post, it has no variables. It only has two constructors.
I tried to amend the code below so you could get the concepts.
To use a class's constructor, you create an instance of that class (usually using the "new" operator). The constructor for the base class is always called, either explicitly (using "super" ) or implicitly.
You also ask "Why are these declarations called constructors even though Base2 b2 = new Base2(); is also called a constructor, but is a completely different thing?"
The methods declared ARE the constuctors.
Base2 b2 = new Base2();
is an example of calling Base2's constructor using the "new" operater.
Hope this helps.
Stephanie