Defining a Constructor

In def'n of cons, used

  return new List(First,Rest);

               Î name of constructor (same as name of the class)

The constructor tells Java how  to construct a list cell.

cons  is like a constructor, but has a returned  value;

we call it a

"pseudo-constructor"

 

 

To Next Slide To Previous Slide To Contents