I want to understand all the advantages of singly rooted class (object
) hierarchy in languages like .NET, Java.
I can think of one advantage. Let's say I have a function which I want to accept all data types (or references thereof). Then in that case instead of writing a function for each data type, I can write a single function:
public void MyFun(object obj)
{
// Some code
}
What other advantages we get from such type of hierarchy?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…