System.Object

Base class of all classes

WSupported on Windows
USupported on Unix
VSupported on OpenVMS
NSupported in Synergy .NET
namespace System
public class Object

System.Object is the base class of all classes. It’s the same as @*.

Constructors

Object

public Object()

Initializes a new instance of the Object class.

Methods

Equals

public static Equals(object), boolean

Returns true if object (@*) is equal to the instance object; otherwise returns false. Note that a derived type might override the Equals() method to implement value equality.

or

public static Equals(object1, object2), boolean

Returns true if object1 (@*) is the same instance as object2 (@*), or if both are ^NULL, or if object1.Equals(object2) returns true; otherwise returns false.

MemberwiseClone

protected virtual MemberwiseClone(), @*

Returns a shallow copy of the current object.

ReferenceEquals

public static ReferenceEquals(object1, object2), boolean

Returns true if object1 (@*) is the same instance as object2 (@*) or if both are ^NULL; otherwise returns false.

ToString

public virtual ToString(), string

Returns the string representation of the current instance, unless a derived type overrides ToString().

The default implementation for System.Object.ToString() gives the name of the class, so if you create another class (for example, class1) and don’t override ToString(), calling ToString() will give a string that contains the fully qualified name of the class (for example, ns1.class1).

Creating a dynamic array of classes using the Object class

When you use the Object class (@*), the compiler doesn’t know what type of object the variable is at compile time. Therefore, you must use casting when accessing a class in an array declared with the @* type. For example,

namespace nsTheNameSpace
    public class clTheClass
        public file     ,a15
        public method clTheClass
        proc
            file = "ABC DEF GHI JKL"
        endmethod
    endclass
endnamespace
.define NUM_OBJS 10
main
record named
    chn         ,i4
    counter     ,i4
    clss        ,[#]@*          ;Declare a dynamic array of any type classes
proc
    open(chn=0,O,"TT:")
    clss = new clTheClass[NUM_OBJS]
    for counter from 1 thru NUM_OBJS
        begin
          clss[counter] = new clTheClass()
          ;Line below compiles when object is cast
          writes(chn,((clTheClass)clss[counter]).file)
          ;Line below does not compile, because clss declared with *
          ;writes(chn,clss[counter].file)
        end
end