Skip to content

Commit 7c52357

Browse files
Another Project on Inheritance
1 parent 230e801 commit 7c52357

File tree

16 files changed

+228
-0
lines changed

16 files changed

+228
-0
lines changed
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
610 Bytes
Binary file not shown.
878 Bytes
Binary file not shown.
159 Bytes
Binary file not shown.
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package AnimalClass1;
2+
3+
public class Birds extends MainAnimalClass {
4+
public int AnimalWithFeaters;
5+
public int CanFly;
6+
public int getAnimalWithFeaters() {
7+
return AnimalWithFeaters;
8+
}
9+
public void setAnimalWithFeaters(int animalWithFeaters) {
10+
AnimalWithFeaters = animalWithFeaters;
11+
}
12+
public int getCanFly() {
13+
return CanFly;
14+
}
15+
public void setCanFly(int canFly) {
16+
CanFly = canFly;
17+
}
18+
@Override
19+
public String toString() {
20+
return "Birds [AnimalWithFeaters=" + AnimalWithFeaters + ", CanFly=" + CanFly + "]";
21+
}
22+
public Birds(int animalWithFeaters, int canFly) {
23+
super();
24+
AnimalWithFeaters = 100;
25+
CanFly = 200;
26+
}
27+
28+
29+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package AnimalClass1;
2+
3+
public class Fish extends MainAnimalClass{
4+
public int LiveINwater;
5+
public int HasGills;
6+
public int getLiveINwater() {
7+
return LiveINwater;
8+
}
9+
public void setLiveINwater(int liveINwater) {
10+
LiveINwater = liveINwater;
11+
}
12+
public int getHasGills() {
13+
return HasGills;
14+
}
15+
public void setHasGills(int hasGills) {
16+
HasGills = hasGills;
17+
}
18+
@Override
19+
public String toString() {
20+
return "Fish [LiveINwater=" + LiveINwater + ", HasGills=" + HasGills + "]";
21+
}
22+
//constructure
23+
public Fish(int liveINwater, int hasGills) {
24+
super();
25+
LiveINwater = 50;
26+
HasGills = 60;
27+
}
28+
29+
30+
}

0 commit comments

Comments
 (0)