You are viewing a single comment's thread. Return to all comments →
class Flower
{
String whatsYourName() { return "I have many names and types.";
}}
class Jasmine extends Flower {
String whatsYourName() { return "Jasmine"; }
}
class Lily extends Flower {
String whatsYourName()
{ return "Lily"; }}
class Region {
Flower yourNationalFlower()
{return (new Flower());
class WestBengal extends Region {
Jasmine yourNationalFlower() { return (new Jasmine());
class AndhraPradesh extends Region {
Lily yourNationalFlower() { return (new Lily());
}} **
Seems like cookies are disabled on this browser, please enable them to open this website
Covariant Return Types
You are viewing a single comment's thread. Return to all comments →
class Flower
{
}}
class Jasmine extends Flower {
}
class Lily extends Flower {
String whatsYourName()
class Region {
Flower yourNationalFlower()
}}
class WestBengal extends Region {
}}
class AndhraPradesh extends Region {
}} **