Commits

Anonymous committed acda7f3

Updated function demo (again) (even cooler this time)

Comments (0)

Files changed (1)

src/d3/Demo6.scala

 	  
 	  Console.println(c.name + " costs $" + c.getCost(costCalc));
 	  
-	  val costCalcInstance = new CostCalculator
-	  val newCost2 = c.getCost(costCalcInstance.tripleBase)
+	  val costCalcInstance = new CostCalculator(3)
+	  val newCost2 = c.getCost(costCalcInstance.multiBase)
 	  Console.println(c.name + " costs $" + newCost2);
   }
   
 	}
 }
 
-class CostCalculator {
-    def tripleBase(base: Double) = base * 3
+class CostCalculator(multiple: Double) {
+    def multiBase(base: Double) = base * multiple
 }