public record Person
{
public string LastName { get; }
public string FirstName { get; }
public Person(string first, string last) => (FirstName, LastName) = (first, last);
}
//a record is like a simple way to declare a class
public record Person(string name,int age);
Person p1=new person("John",21);
Person p2=new person("Jane",24);
public sealed record Student : Person
{
public int Level { get; }
public Student(string first, string last, int level) : base(first, last) => Level = level;
}
public record Teacher : Person
{
public string Subject { get; }
public Teacher(string first, string last, string sub)
: base(first, last) => Subject = sub;
}