Skip to content

Commit 1a6716b

Browse files
committed
object class inheritance prototype
1 parent 48d6cd5 commit 1a6716b

File tree

3 files changed

+68
-1
lines changed

3 files changed

+68
-1
lines changed

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"liveServer.settings.port": 5501
2+
"liveServer.settings.port": 5502
33
}

oop/index.html

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>Document</title>
7+
</head>
8+
<body>
9+
<script src="script.js"></script>
10+
</body>
11+
</html>

oop/script.js

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
// // protyotype
2+
3+
// university={
4+
// name:"UoK",
5+
// teacher:200,
6+
// salary(){
7+
// console.log("Salary is 200 usd")
8+
// }
9+
10+
// }
11+
12+
// bonus={
13+
// extra:"30%"
14+
// }
15+
16+
// bonus.__proto__=university
17+
18+
// //class
19+
20+
// class universal {
21+
// wages(){
22+
// console.log("Wages are 20%")
23+
// }
24+
25+
// controller="admin"
26+
27+
// employeename(ename){
28+
// this.empl=ename
29+
// }
30+
// }
31+
32+
// employee1= new universal()
33+
// employee1.employeename("haitham")
34+
35+
// employee2=new universal()
36+
// employee2.employeename("hafsa")
37+
38+
39+
//inheritance
40+
41+
class Person{
42+
sleep(){
43+
console.log("sleep");
44+
}
45+
eat(){
46+
console.log("eat");
47+
}
48+
}
49+
50+
class engineer extends Person{
51+
work(){
52+
console.log("build diffrent new things");
53+
}
54+
}
55+
56+
let obj=new engineer();

0 commit comments

Comments
 (0)