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
- class MyBase
- {
- private string cr = "Open Source";
- public virtual string Copyright()
- {
- return cr;
- }
- }
- class MyOver: MyBase
- {
- private string lt = string.Empty;
- //overload
- public MyOver(string licensedTo)
- {
- lt = licensedTo;
- }
- public override string Copyright()
- {
- return "Company Conf "+lt;
- }
- // Overload
- public string Copyright(string userName)
- {
- return Copyright()+" "+userName;
- }
- }
Comments
Post a Comment