DATA ABSTRCATION: ================= x-app: functionality-1: data methods ==> hide implementation ==> functionality-2: data methods implementation functionality-3: data methods implementation phonepe check balance implementation money transfer mobile data method implementation upi account TV ==> Remote controller channel up/down volume up/down turnoff turn on ==> The Data or methods in a class, we can give permission to access if required. We can hide if not necessary. This operation is called as "Data Abstraction". Why? === 1) For security 2) Reusability is increased. Class is instantiated. class ClassName: data method obj = ClassName() obj.data obj.method Abstract class: the class cannot be instantiated. but meant to be inherited. from abc import ABC, abstractmethod class abstractClass(ABC): @abstractmethod def myMethod(self): pass """ to add an abstract method inside the abstract class, there is an annotation/decorator "@abstractmethod" """ obj = abstractClass() obj.myMethod() from abc import ABC, abstractmethod class Parent(ABC): # instance method def met1(self): print("This is the common method of the class 'Parent'") @abstractmethod def met2(self): print("Hello") class Child1(Parent): def met2(self): print("The Abstract method of Parent Class is defined in Child1 class.") class Child2(Parent): def met2(self): print("The Abstract method of Parent Class is defined in Child2 class.") # obj1 = Parent() # # obj1.met1() obj1 = Child1() obj1.met2() obj2 = Child2() obj2.met2() ================================ from abc import ABC, abstractmethod class Greetings(ABC): def general(self,name): print("Hi",name) @abstractmethod def wishes(self): print("Welcome") class timeZone1(Greetings): def wishes(self): print("Good Morning.") class timeZone2(Greetings): def wishes(self): print("Good Afternoon.") class timeZone3(Greetings): def wishes(self): print("Good Evening.") # abstract classes are not instantiated # tz1 = timeZone1() # # tz1.general("Ravi") # tz1.wishes() # tz2 = timeZone2() # tz2.general("Kumar") # tz2.wishes() tz3 = timeZone3() tz3.general("Ashwini") tz3.wishes()