Thursday, February 10, 2011

We are all objects

Just like Java, C# has a single rooted class hierarchy where all classes in C# are subclasses of System.Object the same way all Java classes are subclasses of java.lang.Object. The methods of the two languages' Object classes share some similarities (e.g. System.Object's ToString() to java.lang.Object's toString()) and differences (System.Object does not have analogs to wait(), notify() or notifyAll() in java.lang.Object).

NOTE: In C#, the object class can either be written as object or Object. The lower case "object" is a C# keyword which is replaced with the class name "System.Object" during compilation.

No comments:

Post a Comment