016-001-006
Abstract Class: Basics
Hard
Problem Description
abstract class: Basics
In this problem, you will create a program that defines an abstract class Shape, implements a concrete subclass Circle with the draw() method, and displays the result to standard output.
Learning Objective: Understand basic usage of abstract classes and abstract methods
Overview
Create an abstract class representing a Shape and implement a concrete shape class (Circle) that inherits from it. Define an abstract method without implementation in the abstract class.
Specifications
- Shape class (abstract): Define abstract method
draw() - Circle class: Inherit from Shape,
draw()outputs "Drawing a circle" - In Main class, create Circle object and call
draw()
Output Format
Drawing a circle
Ready to Try Running Code?
Log in to access the code editor and execute your solutions for this problem.
Don't have an account?
Sign Up