879243. Abstraction in Python

Easy

Abstraction in Python

Slug: abstraction-in-python Difficulty: Easy Id: 879243 Topic Tags: None Company Tags: None

Summary

Abstraction is a fundamental concept in programming that helps us manage complexity by hiding implementation details and only exposing necessary information. This problem focuses on implementing abstraction in Python, which is essential for writing reusable and maintainable code.

Detailed Explanation

The problem requires you to define an abstract class AbstractClass with two methods: public abstract void abstractMethod() and public void concreteMethod(). The abstractMethod() should be declared as abstract, meaning it must be implemented by any subclass. On the other hand, concreteMethod() is a concrete method that can be overridden or left unmodified in subclasses.

Here's a step-by-step breakdown of the solution:

  1. Define an abstract class AbstractClass with two methods: public abstract void abstractMethod() and public void concreteMethod().
  2. In the concreteMethod(), you can perform any necessary operations or calculations.
  3. Create a subclass that inherits from AbstractClass. This subclass should override the abstractMethod() to provide its own implementation.

Here's an example of how this could look in Python:

View on GeeksforGeeks
// Your code here

DevExCode

Master coding interviews with Leetcode, system design, TechBit, QuickLearn, DevTips, Tech Battles, and career services.

© 2026 DevExCode. All rights reserved.