Created
July 17, 2014 11:36
-
-
Save craigotis/135f88b1ce8beca07400 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class GenericsTest { | |
public class Shape {} | |
public class Circle extends Shape {} | |
public class Sphere extends Circle {} | |
public class ShapeDescriber<T extends Shape> { | |
public void describe(T s) {} | |
} | |
public class CircleDescriber<T extends Circle> extends ShapeDescriber<T> { | |
public void describe(T s) { | |
super.describe(s); | |
} | |
} | |
public class SphereDescriber<T extends Sphere> extends ShapeDescriber<T> { | |
public void describe(T s) { | |
super.describe(s); | |
} | |
public void testTheThing() { | |
this.describe(new Sphere()); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment