N
needin4mation
The code is taken from the book Professional C#:
abstract class GenericCustomer
{
private string name;
public GenericCustomer(string name)
{
this.name = name;
}...
class Nevermore60Customer : GenericCustomer
{
private uint highCostMinutesUsed;
public Nevermore60Customer(string name)
: base(name)
{
}
okay, I get this. it sends "name" back to the abstract class for
construction.
But what about overloading:
class Nevermore60Customer : GenericCustomer
{
public Nevermore60Customer(string name, string referrerName)
: base(name)
{
this.referrerName = referrerName;
}
private string referrerName;
private uint highCostMinutesUsed;
....
public Nevermore60Customer(string name)
: this(name, "<None>")
{
}
When someone sends just:
GenericCustomer customer = new Nevermore60Customer("Arabel Jones");
it will go to the proper constructor, the second one because it has
just a name, but we still wanted to have "<None>" as the string for
referrerName. My question:
Why does this last constructor have "this" instead of "base"?
Thank you for any help.
abstract class GenericCustomer
{
private string name;
public GenericCustomer(string name)
{
this.name = name;
}...
class Nevermore60Customer : GenericCustomer
{
private uint highCostMinutesUsed;
public Nevermore60Customer(string name)
: base(name)
{
}
okay, I get this. it sends "name" back to the abstract class for
construction.
But what about overloading:
class Nevermore60Customer : GenericCustomer
{
public Nevermore60Customer(string name, string referrerName)
: base(name)
{
this.referrerName = referrerName;
}
private string referrerName;
private uint highCostMinutesUsed;
....
public Nevermore60Customer(string name)
: this(name, "<None>")
{
}
When someone sends just:
GenericCustomer customer = new Nevermore60Customer("Arabel Jones");
it will go to the proper constructor, the second one because it has
just a name, but we still wanted to have "<None>" as the string for
referrerName. My question:
Why does this last constructor have "this" instead of "base"?
Thank you for any help.