Question 16: What will be the output of the following program?
class Printer
{
public virtual void Install()
{
Console.WriteLine("Printer Installed.");
}
public virtual void Print(string text)
{
Console.WriteLine("Printing: " + text);
}
}
class LaserPrinter : Printer
{
public override void Install()
{
Console.WriteLine("Laser Printer Installed Successfully.");
}
public void InstallDrivers()
{
Console.WriteLine("Drivers for Laser Printer Installed.");
}
}
Printer prnt = new LaserPrinter();
prnt.Install();
Question 17: What will be the output of the following program?
class Printer
{
public virtual void Install()
{
Console.WriteLine("Printer Installed.");
}
public virtual void Print(string text)
{
Console.WriteLine("Printing: " + text);
}
}
class LaserPrinter : Printer
{
public void Install()
{
Console.WriteLine("Laser Printer Installed Successfully.");
}
}
Printer printer1 = new LaserPrinter();
printer1.Install();