Skip to content

Commit 18669e1

Browse files
committed
Clase ES6: Suprascrierea 'Metodelor' Claselor
1 parent 8429d43 commit 18669e1

File tree

2 files changed

+61
-0
lines changed

2 files changed

+61
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<meta charset="UTF-8" />
6+
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
7+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
8+
<title>
9+
Clase ES6: Suprascrierea 'Metodelor' Claselor
10+
</title>
11+
</head>
12+
13+
<body>
14+
<h1>Clase ES6: Suprascrierea 'Metodelor' Claselor</h1>
15+
16+
<!-- IMPORTARE FISIER 'JS' -->
17+
<script src="js/clase/clase_es6__suprascrierea_metodelor_claselor.js"></script>
18+
</body>
19+
20+
</html>
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/* ===============================================================
2+
CLASE ES6 (ECMASCRIPT6)::
3+
SUPRASCRIEREA 'METODELOR' CLASELOR
4+
=================================================================*/
5+
6+
7+
//=================================================================
8+
// (1) CLASA 'FORMA':
9+
//=================================================================
10+
class Forma {
11+
12+
// METODA:
13+
miscare() {
14+
console.log('Miscarea Cercului');
15+
}
16+
}
17+
18+
19+
//=================================================================
20+
// (2) CLASA 'CERC' CARE 'EXTINDE' CLASA 'FORMA':
21+
//=================================================================
22+
class Cerc extends Forma {
23+
24+
25+
// SUPRASCRIEREA METODEI 'MISCARE()':
26+
miscare() {
27+
28+
// ACCESAREA METODEI 'PARINTE':
29+
super.miscare();
30+
31+
// AFISARE:
32+
console.log('miscare');
33+
}
34+
}
35+
36+
37+
38+
//=================================================================
39+
// (3) CREAREA OBIECTULUI 'CERC':
40+
//=================================================================
41+
const c = new Cerc('Albastru Maritim', 1);

0 commit comments

Comments
 (0)