July 2019
Intermediate to advanced
416 pages
10h 6m
English
class FahrenheitToCelsius { Convert(temperature : number) : number { return (temperature - 32) * 5 / 9; }}class CelsiusToFahrenheit { Convert(temperature : number) : number { return (temperature * 9/5) + 32; }}
We want to write a method that accepts a temperature and an instance of either of these types, which will then perform the relevant calculation. What technique would we use to write this method?
class Command { public constructor(public Name : string = "", public Action : Function = new Function()){}}Read now
Unlock full access