Documentation for SOOP API Library v1.0
Table of Contents

Class Definition

The core of structuring Data and Routines in SOOP


Class definition is the ability to structure Euphoria Data and Routines, into a easy to access method, and improved diversity. SOOP Classes do not have the same namespace as Euphoria does, so there's no name conflict between Euphoria, and SOOP.

Some things to note:

  • Class Block refers to the the definition of a class through the same method as a for loop, while loop, if statement, and such.
  • Object Instance refers to a New Instance of a Pre-Defined Class
  • When doing a Class Definition, it is not nesscary to declare your method routines as global's, since everything in soop is considered global.
  • When using members, Each member is reserved it's own variable space in a object instance.

  • proc Class( sfStr ClassName )   Begins a Class Definition.
  • proc Constructor( eObj RoutineID )   Adds RoutineID to the list of Constructors for a class.
  • proc Deconstructor( eObj RoutineID )   Adds RoutineID to the list of Deconstructors for a class.
  • proc EndClass()   Terminates the Class Definition Block your currently in.
  • proc Inherit( sfStr ClassName )   Allows the current class to Inherit attributes from a parent class.
  • proc Member( sfStr MemberName, dt DataType )   Declares MemberName in the current Class Definition, of DataType.
  • proc Method( sfStr MethodName, eAtom RoutineID )   Attaches a Euphoria Routine to a Class Definition.

    Documentation for SOOP API Library v1.0
    Table of Contents

    [proc]
    Class
    ( sfStr ClassName )

    Begins a Class Definition.

    Category: Class Definition

    This begins a Class definition, in which you can define various attributes about the class definition, from variables, to routines, that will be specific to that class. When a new object instance is created, it will receive all the attributes of that class in Memory, seperating it from other objects. In lamen terms, it's like creating a application within an application.

    Nested Classes are not allowed, but Classes can be parented to multiple diffrent classes. See Inherit for more details.

    See Also: Constructor, Deconstructor, EndClass, Inherit, Member, Method


    Documentation for SOOP API Library v1.0
    Table of Contents

    [proc]
    Constructor
    ( eObj RoutineID )

    Adds RoutineID to the list of Constructors for a class.

    Category: Class Definition

    Constructors allow you a chance to fill information into your Object Instance, and do special things, such as allocate memory, or create Window Handles. Constructors are executed in the order that they are specified, and you can add a single Constructor routine, or add multiple Constructor routines by means of a sequence.

    Constructor can only be defined in a Class Definition block.

    See Also: Class, Deconstructor, EndClass, Inherit, Member, Method


    Documentation for SOOP API Library v1.0
    Table of Contents

    [proc]
    Deconstructor
    ( eObj RoutineID )

    Adds RoutineID to the list of Deconstructors for a class.

    Category: Class Definition

    Like the Constructors, this gives you a chance to free up resources that you may have created during the lifetime of the object. Deconstructors are executed int he same way as Constructors are, and Deconstructors are executed when a Object Instance is recycled (AKA Destroyed).

    Deconstructors can only be defined in a Class Definition block.

    See Also: Class, Constructor, EndClass, Inherit, Member, Method


    Documentation for SOOP API Library v1.0
    Table of Contents

    [proc]
    EndClass
    ()

    Terminates the Class Definition Block your currently in.

    Category: Class Definition

    This is pretty much self explanitory, it terminates the definition of the current class you are in, and makes it officially available for use by any of the Class routines, or rather, more specifically the new() routine.

    See Also: Class, Constructor, Deconstructor, Inherit, Member, Method


    Documentation for SOOP API Library v1.0
    Table of Contents

    [proc]
    Inherit
    ( sfStr ClassName )

    Allows the current class to Inherit attributes from a parent class.

    Category: Class Definition

    Inherit is one of the best things about Object Oriented, it allows you to do sub-classing of a parent class, where you can receive all of the parent's attributes, without having to re-define anything, or re-write code. Proper polymorphism is done, to allow refrencing to be done with ease of usage.

    Inherit can only be declared within a Class Definition block. When parenting a class, you cannot parent the current class that you are defining, and you cannot parent the same class twice.

    See Also: Class, Constructor, Deconstructor, EndClass, Member, Method


    Documentation for SOOP API Library v1.0
    Table of Contents

    [proc]
    Member
    ( sfStr MemberName, dt DataType )

    Declares MemberName in the current Class Definition, of DataType.

    Category: Class Definition

    Members can become the most powerful part of an Object Oriented Language, they allow for class objects to have their own reserved areas of memory for data to be stored in. This makes it possible for same like data to be stored in a Euphoria Progam, in a more structured way, without the need to use Constants, and taking away from Euphoria's Namespace issues.

    Members can only be declared within a Class Definition block.

    See Also: Class, Constructor, Deconstructor, EndClass, Inherit, Method


    Documentation for SOOP API Library v1.0
    Table of Contents

    [proc]
    Method
    ( sfStr MethodName, eAtom RoutineID )

    Attaches a Euphoria Routine to a Class Definition.

    Category: Class Definition

    This allows for Routines to be attached to Classes, so that when a object instance is created, the method can easily access the data stored within said object. This leads to several advantages.

  • Each class object will have it's own variable space, so that copies of the same class object, does not overwrite each other.
  • Methods can easily refer to the object instance from which they are called from, by refering to the read-only 'this' variable.

    Methods can only be defined within a Class Definition block.

    See Also: Class, Constructor, Deconstructor, EndClass, Inherit, Member