Dart Abstract Class : Concrete Subclass

Dart Abstract Class : Concrete Subclass

·

1 min read

Concrete Subclass :

  • The concept of a concrete class is inherent in object-oriented programming and is not confined to Dart or Flutter.

  • A concrete class is a standard class where each method carries its specific implementation. No method in a concrete class should lack an implementation.

  • Understanding this is crucial in Dart programming, especially when working with abstract and concrete classes.

  • Remember, unlike an abstract class, a concrete class must not contain any abstract methods as defined by the abstract keyword.

    ```dart

    abstract class Shape {

    void draw();

void display() { print('Displaying shape...'); } }

class Circle extends Shape { @override void draw() { print('Drawing circle...'); } }

class Square extends Shape { @override void draw() { print('Drawing square...'); } }

void main() {

Circle circle = Circle(); Square square = Square();

circle.draw(); circle.display();

square.draw(); square.display(); }


* ```dart
    Drawing circle...
    Displaying shape...
    Drawing square...
    Displaying shape...

    Exited.