Additional Constructors for Unicalc Quantity

 

Another constructor constructs a Quantity out of just a multiplier:

 

class Quantity
{
double multiplier;
StringList numerator;
StringList denominator;

 

.... other constructors  for Quantity ....

 

Quantity(double multiplier) 		// constructor head
  {					// constructor body
  this.multiplier = multiplier;
  this.numerator = Stringlist.nil;
  this.denominator = Stringlist.nil;
  }

 

.... other constructors and methods for Quantity ....
}

 

Notice that outside the class Stringlist we must qualify the value or method by prefixing the classname: Stringlist.nil

Next Slide Previous Slide Contents