Tech Qu: Create a class and then a 2nd class that both overrides and overload.

A trivial item – but a few folks may get confused with the double “over”.

 

 

Code Snippet
  1. class MyBase
  2.   {
  3.     private string cr = "Open Source";
  4.     
  5.     public virtual string Copyright()
  6.     {
  7.       return cr;
  8.     }
  9.     
  10.   }
  11.   class MyOver: MyBase
  12.   {
  13.     private string lt = string.Empty;
  14.     //overload
  15.     public MyOver(string licensedTo)
  16.     {
  17.       lt = licensedTo;
  18.     }
  19.     public override string Copyright()
  20.     {
  21.       return "Company Conf "+lt;
  22.     }
  23.     // Overload
  24.     public string Copyright(string userName)
  25.     {
  26.       return Copyright()+" "+userName;
  27.     }
  28.   }

Comments

Popular posts from this blog

Simple WP7 Mango App for Background Tasks, Toast, and Tiles: Code Explanation

Yet once more into the breech (of altered programming logic)

How to convert SVG data to a Png Image file Using InkScape