overidding
what is overiding , why and what is it used for.....
Here is some sample code that is confusing me....
Nothing new there then.... lol
public override string ToString()
{
return "Name:" + Name "\nVal" + Val;
}
This is on page 243 of the book begging visua c# 2005
later we have console.WriteLine(myObj.ToString());
so what is called here the function above or method above
and can some one explain the reason for doing this.. why not just
write myObj.methodname() directly
like
public string methodname(void)
{
return "Name:" + Name "\nVal" + Val;
}
|