Abstraction In Python?

  • – It is nothing but hiding the implementation.
  • – Python doesn’t support abstract class, interface concept like other programming language.
  • – But if there is any restriction to use that then we can implement by using “pass” keyword.

How To Implement Abstraction In Python-

Ex-

class Calc:
    def sub(self, a, b):
        pass

class Calculator(Calc):
    def sub(self, a, b):
        c = a - b
        print(c)

    def main():
        obj = Calculator()
        obj.sub(70,30)

Calculator.main()

Output-

	40
Menu