Partager via


Object Hierarchy Semantics 

In Visual J#, java.lang.Object is treated as a language-specific root of the object hierarchy. Access this object from languages supported by the common language runtime by means of Object. Thus, such languages do not see Visual J# objects as special objects deriving from java.lang.Object.

For example, this is a class written in Visual J#, and you cannot access the object method toString in other languages:

class A extends java.lang.Object { 
    public String toString() { return "Instance of A";}
}

Instead, use the following to get the string representation of the object from Visual C#:

string str = new A().ToString(); 

Note

This is true even if A were to override an implementation of the toString method.

To a Java-language developer, Visual J# treats Object like java.lang.Object and maps the functionality to make any differences transparent. This support makes it possible to pass java.lang.Object to Object and vice-versa for assignments, parameter passing, and other usages. The same is true for java.lang.String and Object.

Consuming Visual J# binaries is no different from consuming any other binary generated by such languages as Visual Basic or Visual C#.

See Also

Other Resources

Language Support