Answer the question
In order to leave comments, you need to log in
Question about delegating constructor c#?
How will this code work?
If 1 argument is received in the constructor, will an object be created with 2 default values?
If 2 then with only 1 default value.
I understand correctly?
class Block
{
private int id;
private int meta;
private stringname;
private float breakTime;
public Block(int id)
: this(id, 0) { }
public Block(int id, int meta)
: this(id, meta, "Unknown") { }
public Block(int id, int meta, string name)
{
this.id = (int)id;
this.meta = (int)meta;
this.name = name;
breakTime = 0.20f;
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question