24 lines
526 B
Java
24 lines
526 B
Java
![]() |
//: reuse/Cartoon.java
|
|||
|
// <20>2015 MindView LLC: see Copyright.txt
|
|||
|
// Constructor calls during inheritance.
|
|||
|
import static com.mindviewinc.util.Print.*;
|
|||
|
|
|||
|
class Art {
|
|||
|
Art() { print("Art constructor"); }
|
|||
|
}
|
|||
|
|
|||
|
class Drawing extends Art {
|
|||
|
Drawing() { print("Drawing constructor"); }
|
|||
|
}
|
|||
|
|
|||
|
public class Cartoon extends Drawing {
|
|||
|
public Cartoon() { print("Cartoon constructor"); }
|
|||
|
public static void main(String[] args) {
|
|||
|
Cartoon x = new Cartoon();
|
|||
|
}
|
|||
|
} /* Output:
|
|||
|
Art constructor
|
|||
|
Drawing constructor
|
|||
|
Cartoon constructor
|
|||
|
*///:~
|