Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot inherit Shapes

Why I can't use a class that inherits a Shapes class?

I need to extend the Rectangle class with some methods, but i want to use this class in the same way I use a Shape, how can I do?

like image 687
gliderkite Avatar asked Dec 20 '22 20:12

gliderkite


1 Answers

You can write a class which derives from Shape. You can't write a class which derives from Rectangle, because that's sealed.

like image 156
Jon Skeet Avatar answered Dec 29 '22 01:12

Jon Skeet