Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

返回值范围不理解 #92

Closed
DennisThink opened this issue Dec 19, 2018 · 1 comment
Closed

返回值范围不理解 #92

DennisThink opened this issue Dec 19, 2018 · 1 comment

Comments

@DennisThink
Copy link
Contributor

image

如何理解返回值范围

@DennisThink
Copy link
Contributor Author

返回值的协变类型。

class Shape{
}

class Circle extends Shape{
} 

class ShapeBuilder{
        Shape GetShape(){
            return new Shape();
       }
}

class CircleBuilder extends ShapeBuilder{
        @Override
        Circle GetShape(){
                  return new Circle();
      }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant