-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinheritance.html
More file actions
58 lines (51 loc) · 1.47 KB
/
Copy pathinheritance.html
File metadata and controls
58 lines (51 loc) · 1.47 KB
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
51
52
53
54
55
56
57
58
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<script>
class operations {
constructor() {
console.log(`this is the parent class `);
}
addition(a, b) {
this.a = a;
this.b = b;
console.log(`the addition of two number is "${a + b}"`);
}
Subtraction(a, b) {
this.a = a;
this.b = b;
console.log(`the Subtraction of two number is "${a - b}"`);
}
Multiplication(a, b) {
this.a = a;
this.b = b;
console.log(`the Multiplication of two number is "${a * b}"`);
}
Division(a, b) {
this.a = a;
this.b = b;
console.log(`the Division of two number is "${a / b}"`);
}
}
class newOperations extends operations {
constructor(a, b) {
super(a, b);
console.log(`this is the child class `);
}
Modulus(a, b) {
console.log(`the Modulus of two number is "${a % b}"`);
}
}
let main = new operations
main.addition(5, 6)
main.Subtraction(5, 6)
main.Multiplication(5, 6)
main.Division(5, 6)
let child = new newOperations
child.addition(20, 30);
child.Modulus(50, 20);
// </script>
</body>
</html>