<HTML>
<HEAD>
<TITLE>Using Superclass Variables With Subclassed Objects</TITLE>
</HEAD>
<BODY>
<H1>Using Superclass Variables With Subclassed Objects</H1>
<%!
javax.servlet.jsp.JspWriter localOut;
class BaseClass
{
public void start() throws java.io.IOException
{
localOut.println("Starting...<BR>");
}
}
class DerivedClass1 extends BaseClass
{
public void fly() throws java.io.IOException
{
localOut.println("Flying...<BR>");
}
}
class DerivedClass2 extends DerivedClass1
{
public void fly() throws java.io.IOException
{
localOut.println("Flying...<BR>");
}
}
%>
<%
localOut = out;
out.println();
out.println("Creating a DerivedClass2 object...<BR>");
BaseClass p = new DerivedClass2();
p.start();
%>
</BODY>
</HTML>
|