static void Main(string[] args) { PrePaidInvoice p = new PrePaidInvoice(); p.GetDate(); p.DoPrint(); Console.ReadKey(); }
private static void UsingBaseExample() { PrePaidInvoice p = new PrePaidInvoice(); p.GetDate(); /* When the DoPrint method is called on an instance of the PrePaidInvoice class, it first * makes a call of the DoPrint method in the parent object. */ p.DoPrint(); }
public static void executeTest() { invoice c = new invoice(); c.getDate(); c.DoPrint(); Console.ReadKey(); PrePaidInvoice p = new PrePaidInvoice(); p.getDate(); p.DoPrint(); Console.ReadKey(); }
public static void RunMethodOverriding() { //create an invoice Invoice receipt = new Invoice(); PrePaidInvoice p = new PrePaidInvoice(); receipt.GetDate(); //set date method from Document receipt.DoPrint(); //do print method from Invoice // p.GetDate(); p.DoPrint(); Console.ReadLine(); }
// The use of method overriding allows the behavior of different items to be customized for each particular item, // and you can also re-use code in parent objects by using the base keyword. public void BaseCall() { PrePaidInvoice p = new PrePaidInvoice(); p.DoPrint(); }