forked from angiejones/java-programming
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInheritanceTester.java
More file actions
37 lines (28 loc) · 939 Bytes
/
Copy pathInheritanceTester.java
File metadata and controls
37 lines (28 loc) · 939 Bytes
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
package chapter9;
public class InheritanceTester {
public static void main(String[] args){
Mother mom = new Mother();
mom.setName("Glenda");
System.out.println(mom.getName() + " is a " + mom.getGender());
}
public static void testSquareOverride(){
Rectangle rectangle = new Rectangle();
rectangle.setLength(4);
rectangle.setWidth(8);
System.out.println(rectangle.calculatePerimeter());
Square square = new Square();
square.setLength(4);
square.setWidth(8);
System.out.println(square.calculatePerimeter());
}
public static void testInheritance(){
Employee employee = new Employee();
employee.setName("Angie");
}
public static void testOverload(){
Rectangle rectangle = new Rectangle();
rectangle.print();
Square square = new Square();
square.print("square");
}
}