Its EuropeWho – Teams, Skype for Business, and other things.

virtual & override methods

So, I am looking at classes with different behaviours.

And just trying to get back “on the bike” with the various keywords in the Visual C#.NET editor.

Creating a new class and adding a procedure to it….

The master class (HAR HAR) has the function indicated with the virtual keyword. Indicating it could be “taken over” or “highjacked” by a child class that inherits the master class.

This is the master class.

public class MasterVehicle
{
private string _nameOfMasterVehicle = string.Empty;
/// <summary>
/// NameOfVehicle
/// Will set the name of the vehicle.  Will only set it if the variable passed in has one or more characters
/// </summary>
/// <param name="TheName"></param>
public virtual void NameOfVehicle(string TheName)
{
if(TheName.Count()>0)
{
// ok there is more than one character in the passed in string
_nameOfMasterVehicle = TheName;
}
}
}

Ok thats the master class…. It has the virtual keyword.

That doesn’t mean that any class that inherits it, needs to take that virtual procedure. OH NO.

But if I want to I can do this:

public class Car : MasterVehicle
{
/// <summary>
/// This is the overriden method that was written in the MasterVehicle class
/// </summary>
/// <param name="TheName"></param>
public override void NameOfVehicle(string TheName)
{
base.NameOfVehicle(TheName);
}
}

There you can see I inherited the master vehicle class in the first declaration of the child class and then put a proc in that uses the override keyword to errrr override the method called “NameOfVehicle”.

Just Say Hello

Yep just say Hello!

I’m not against people just pinging me on Teams / Skype for Business / Skype or any other messaging engine, just to say Hi!

And HELLO back!

Welcome

This is my blog! Simple eh?

Well not really, I’m dealing with these subjects, (a load of them)…

  • Microsoft Teams Client.
  • Development in .NET.
  • Empathy.
  • Negotiation.
  • Investing in peers.

So that’s an eclectic mix eh?
Most of them will be short and sweet, I’ll make sure I update each of the subjects as soon as I can.
Please do comment and please have a look around.