16 lines
370 B
TypeScript
Raw Normal View History

2020-03-28 14:45:55 +01:00
import {Car} from './car'
2020-03-28 19:49:57 +01:00
// create a new car and store it in the variable 'a'
2020-03-28 14:45:55 +01:00
const a = new Car();
2020-03-28 19:49:57 +01:00
// set some data for that car
2020-03-28 14:45:55 +01:00
a.manufacturer = 'Benz';
a.model = 'Velo';
2020-03-28 19:49:57 +01:00
// do the same for a second car
2020-03-28 14:45:55 +01:00
const b = new Car();
b.manufacturer = 'Ford';
b.model = 'Model T';
2020-03-28 19:49:57 +01:00
// use a function of the car class to print out the information
2020-03-28 14:45:55 +01:00
a.print_info();
b.print_info();