Object Oriented Language Implementation

Lectures 23-24

Class Abc {

        int a;

        A obja;

        static int sa;

        static double sd;

        Abc();

        Abc(int);

        void Abc();

        void Abc(double); }

e.g. Abc() is written as <init>_Abc, Abc(int) -> <init>_Abc@I

e.g. Abc() -> Abc@obj * <init>_Abc

       Abc(int) -> Abc@obj * <init>_Abc@I

       Abc(Abc) -> Abc@obj * <init>_Abc@Abc

         e.g. Additions in constructor’s body

Abc() {

        Abc@obj temp;

        temp = (Abc@obj) malloc (sizeof(Abc@obj)) ;

// Based on super class call will be made to super //constructor

return temp;

}

e.g. sort(<T> Array[], Int size) used as

       sort(Int Array[], Int size), sort(Double Array[], Int size)

Class Shape {

        int dist;

        Point center;

        static int sa;

        static double sd;

        Shape();

        Shape(int);

        void Shape();

        void Shape(double);

}

Shape s;

Circle c = new Circle();

s=c;

Circle c1 = (Circle) s;