So I need to understand which way is the correct/best one?
First way:
class Customer
{
string firstName;
string lastName;
public Customer(string firstName="non", string lastName="applicable")
{
this.firstName = firstName;
this.lastName = lastName;
}
}
Second way:
class Customer
{
string firstName;
string lastName;
public Customer()
: this("non","applicable")
{ }
public Customer(string firstName, string lastName)
{
this.firstName = firstName;
this.lastName = lastName;
}
}
If I'm creating a method printFullName(), it works in both cases. So which one to chose? The first one seems easier to me.