Search code examples
androidrect

Extend a class with rectangle


I want to extend a class called Square with Rectangle that is,

public class Square extends Rect {}

But the compiler complains as "The type Square cannot subclass the final class Rect"

Is there a work around?


Solution

  • A final class cannot be subclassed.

    Rect is a final class. so cannot subclass the Rect class