How can I use the data of the underlying constructor for another constructor in the same class?
when trying to call the base constructor, it throws an error like "the object does not contain a constructor that takes one argument"
public string FirstName { get;private set; }
public string LastName { get;private set; }
public Employee(string firstName)
{
FirstName = firstName;
}
public Employee(string firstName,string lastName):base(firstName)//error
{
LastName = lastName;
}
public string SayHello()
{
return FirstName + " " + LastName;
}
thank
+3
source to share