...

/

Solution Review: Implement the Parametrized Constructor

Solution Review: Implement the Parametrized Constructor

This review provides a detailed analysis on how to solve the 'Implement the Parametrized Constructor' challenge.

We'll cover the following...

Solution

Press + to interact
// Base Class
class Laptop {
// Private Data Members
public string Name{get; set;}
public Laptop() { // Default Constructor
}
public Laptop(string name) { // Default Constructor
this.Name = name;
}
}
// Derived Class
class Dell : Laptop {
public Dell(string name)
: base(name)
{
}
}
class Demo {
public static void Main(string[] args) {
Dell dell = new Dell("Dell Inspiron");
Console.WriteLine(dell.Name);
}
}

Explanation

...