More Raster Object

    
        ///////////////////////// Constructors //////////////////////
    
        /**
         *  This constructor, which takes no arguments,
         *  allows for future extension.
         */
        public Raster()
        {
        }
    
        /**
         *  This constructor creates an uninitialized
         *  Raster Object of a given size (w x h).
         */
        public Raster(int w, int h)
        {
            width = w;
            height = h;
            pixel = new int[w*h];
        }
    	
    • Constructors are called when an instance of this class is created (via new)
    • Example of Overloading
    • You should almost always have a constructor that takes no arguments
Lecture 2 Slide 20 6.837 Fall '98