-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcar_class.ts
50 lines (46 loc) · 1.22 KB
/
car_class.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
class car
{
color:String;
engine_capacity:number;
no_of_cylinders:number;
constructor(color:String, engine_capacity:number,no_of_cylinders:number)
{
this.color=color;
this.engine_capacity=engine_capacity;
this.no_of_cylinders=no_of_cylinders;
}
mymethod = ()=>{
let a = 100;
console.log(a);
return a+123;
}
start_car():void
{
console.log("Inside Start_car method");
}
stop_car():void
{
console.log("Inside Stop_car method");
}
accelerator_car():void
{
console.log("Inside Accelerator_car method");
}
open_carlock():void
{
console.log("Inside Open_carlock method");
}
close_carlock():void
{
console.log("Inside Close_carlock method");
}
}
var objcar=new car("Blue",1197,4)
console.log("color of car is :"+" "+objcar.color);
console.log("Engine capacity of car is :"+" "+objcar.engine_capacity);
console.log("No of cylinders in car is :"+" "+objcar.no_of_cylinders);
objcar.start_car();
objcar.stop_car();
objcar.accelerator_car();
objcar.open_carlock();
objcar.close_carlock();