-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathles20.dart
41 lines (34 loc) · 1.03 KB
/
les20.dart
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
//--> OOP-class // overriding methods
void main (){
Student s=Student(); //see below ... and you can call Human Eating
s.name='ahmed';
s.eat();
// HighSchool s=HighSchool();
// s.eat();
}
class Human {
String? name;
void eat() {
print ('====================');
print (' Human Eating');
print ('====================');
}
}
class Student extends Human {
String? studyAt;
@override // should put it .. as they say ..!!
void eat(){ //1 overriding the above method
print (' +++overriding+++');
print (' Student Eating');
print ('++++++++++++++++++');
}
}
class HighSchool extends Human { // try insert the main parentclass Heman ??! run ...
String? acadNum;
@override // should put it .. as they say ..!!
void eat(){ //2 overriding the above method see above ..
print (' +++@override+++');
print (' High School Eating');
print ('++++++++++++++++++++++');
}
}