public class Component
{
public Component() {}
}
interface Printable
{
void printHeader(float factor);
void printFooter(float factor);
}
public class TextField: Component, Printable
{
public TextField(string text)
{
this.text = text;
}
// implementing Printable.printHeader()
public void printHeader(float factor)
{
}
// implementing Printable.printFooter()
public void printFooter(float factor)
{
}
private string text;
}
class MainClass
{
public static void Main()
{
TextField text = new TextField("Hello");
Printable scalable = (Printable) text;
scalable.printHeader(0.5F);
scalable.printFooter(0.5F);
}
}
|