The base keyword with inheritance. (C#, .NET Framework)

The base keyword with inheritance. (C#, .NET Framework)

Using the keyword "base" allows us to access members of the base class from within a derived class (child class).

For example, if we've created a constructor in the parent class and want our child class to inherit its properties.

Parent:

        public CookieOrder(int orderNumber,
            string recipientName,
            string cookieType,
            int dozens)
        {
            OrderNumber = orderNumber;
            RecipientName = recipientName;
            CookieType = cookieType;
            Dozens = dozens;
        }

Child:

image.png

Full code available at: github.com/Kealiwyn/CookieEmporium