Base class
public class Person
{
public Person(string name)
{
Name = name ?? throw new ArgumentNullException(nameof(name));
}
public string Name { get; }
public virtual void Greet() => Debug.WriteLine($"Hello, I'm {Name}.");
}Constructor arguments
Preserve virtual methods' behavior
Last updated
Was this helpful?