Summary: abstract method is a method which only has declaration and doesn't have definition. a class is called abstract class only if it has at least one abstract method. when you inherit a abstract class as a parent to the child class, the child class should define all the abstract method present in parent class. if it is not done then child class also becomes abstract class automatically. at last, python by default doesn't support abstract class and abstract method, so there is a package called ABC(abstract base classes) by which we can make a class or method abstract.
for those who did not understand! assume a situation or an example (u r given a task to design some apps and an app to qualify it must and should contain some specific features like( brightness, notification ).so basically you can declare an abstract class with these feature declarations( brightness, notification ), but not the body in the abstract class and later u inherit them keeping in mind that while you are designing you must and should declare these feature's body for sure along with some more features and u might use the same abstract class for other app design because even it must also contain the specific features along with other, but the body declarations might change from class to class or an app to app if you are doing any real-time work). hope u understood this
Essentially, you define abstract methods in an abstract class to ensure that it's child classes have a compulsion of having those methods defined inside them
Otherwise, the abstract method that is inherited by the child will make it an Abstract Base class thus preventing instantiation. So if we are to instantiate the child class, implementing the abstract methods becomes necessary.
I see many are still confused with the concept and also with "how is it different from duck typing". Here is an example to get it cleared. This is an exam 'hall' and there are students from 2 diffrent 'classes' seated. Class A has a maths test, Class B has social. The invigilator says that to enter the hall, every one must carry an instrument box. Now students of classes both A and B must bring one even if B class don't have its use. So the class A will have a set of compass, rulers, pencils etc in it. But since students of class B don't have any use, they will just bring one with a pencil or even just empty (pass) because its compulsory to bring one in to be in the hall. If a parent class has an abstract method, every child must also have one. So each child will have to define one of thier own. In duck typing, It isn't necessary to define the parent class method for each child classes. it just simply have to point to the class where the particular method lies. Here we would have to define for each. I hope this helps
for those who did not understand! assume a situation or an example (u r given a task to design some apps and an app to qualify it must and should contain some specific features say brightness, notification .so basically you can declare an abstract class with these feature declarations but not the body and later u inherit them in keeping in mind that while design you must and should declare these feature's body for sure along with some more features and u might use the same abstract class for other app design because even it must also contain the specific features along with other but the body declarations might change from class to class or an app to app if you are doing any real-time work). hope u understood this
@@sujithkumar_ga So I'm still trying to wrap my head around this. From what I'm seeing, using this video as the example, we declare process in the Computer class as an abstract method and therefore we get an error and to fix that error, we override it in a subclass, say Laptop, by redefining process. So then why even bother with the abstract method at all? Making the abstract method just seems like a waste of time if it's not going to do anything and I have to add the actual definition somewhere else.
@@ArjunKrishna-lx1re 🤣 Good question bro, I Think Navin has missing some logics and codes better we have to refer other utubers too , dont rely on him.
Probably need more explanation about this topic. Why we need to create abstract classes. But among all of the youtube videos, this is much much better than others. Thank you...
from abc import * class examhall: @abstractmethod def instrument_box(self): pass #'bring instrument box' def water_bottle(self): print('bring water bottle') class students1(examhall): def maths(self): print('ok, i sure need one for the test') #so let me define an instument box def instrument_box(self): print('pencils, compass, ruler etc') class students2(examhall): def social(self): print('but i dont need one anyway') #but since its compulsory, let me bring an empty one def instrument_box(self): print('empty box') #or just pass s1 = students1() s2 = students2() s1.maths() s1.instrument_box() s2.social() s2.instrument_box()
🎯 Key Takeaways for quick navigation: 00:00 *🖥️ Abstract Class and Abstract Method in Python* - Understanding abstract classes and methods in Python. - Abstract classes in Python are not directly supported but can be achieved using the ABC module. - Abstract methods are defined without implementation and must be implemented by subclasses. - Abstract classes cannot be instantiated and serve as templates for subclasses to implement methods. 03:18 *🛠️ Implementing Abstract Classes and Methods* - Implementing abstract classes and methods using the ABC module. - Importing the ABC module and using the `@abstractmethod` decorator to define abstract methods. - Subclasses of abstract classes must implement all abstract methods. - Attempting to instantiate an abstract class without implementing all abstract methods raises an error. 06:05 *🧩 Practical Application of Abstract Classes* - Exploring the practical applications of abstract classes in object-oriented programming. - Abstract classes provide a blueprint for subclasses to adhere to specific method implementations. - Helps enforce a consistent structure across different subclasses. - Useful for defining APIs or designing systems where certain methods must be implemented by subclasses. Made with HARPA AI
Actually, the function of the abstract class is the programmer shouldn't be able to use a class and its method but he has to provide those methods and its definition to other inheriting classes. By using such a feature the programmer is forcing himself to provide different definitions in inheriting classes. Here what Navin is trying to say is all electronics like laptops desktops and mobiles are computers so the programmers must define all the parts like display and processor to all electronics like laptops desktops and mobiles because without such part they won't work
It's a Object Oriented Programming thing. Maybe you are designing many classes and these classes share a common method (in teacher's example is processing(), so each time you inherit in a new class e.g. Laptop, it is mandatory/compulsory that you define processing() method there. I think it is a way to keep organized your OOP project.
When you have can possible have multiple(different) output/input, then you will need to create a base class(or abstract class) to use for multiple objects.
Thanks a lot sir...please complete data structures and algorithms with python...and if possible start machine learning/data science..as u were telling earlier u we're about to start ...
1. Abstract base class desire its subclass or child class to instantiate the class object by inheriting its base class. 2. ABC methods require to its proceeding methods in a subclass to add the functionality. 3. ABC just def the methods but all its functionality will be designed by a subclass. 4. ABC customize the behaviour of isinstance() and issubclass()
you mean that if i use Whiteboard(Computer) i must have process method in white board class so that only code works is n't ??? thats the use of abstract class i hope you will reply soon.......
By the defination, abstraction is used to hide complexity of program but this defination doesn't seems appropriate in python implementation of abstraction.
For those if didnt understood properly go through below code from abc import ABC, abstractmethod class Shape(ABC): @abstractmethod def area(self): pass
def perimeter(self): return 2 * 3.14 * self.radius class Square(Shape): def __init__(self, side): self.side = side
def area(self): return self.side**2
def perimeter(self): return 4 * self.side 1) here trying to directly instantiate shape will directly result in error as it is defined by abstract 2) here we have declared the area, perimeter as abstract , so any class that inherits shape class were forced to define those methods (or ) will result in error....reason why i did this is for any shape, ie square, rectangle, circle....calculating area and perimeter are important.
I am pretty much sure I have missed something, but I am not sure what it is.At 5:11 - I got the concept that if you inherit an Abstract class, the child class will also be Abstract. That I understood, tried and was successful. But didn't properly get the concept after that. If the parent class is an Abstract Class, and if the child class has its own methods, the methods of the child class run without a problem. Have I got it right?
Thanks for making such helpful video for learners. But I either was not able to understand the ABC concept of class & method by watching this video or video missed the good example of this. Thanks to chatGPT it gave me below real world example which explains the concept really well. e.g. a vehicle might have common attributes like speed, fuel, and methods like start(), stop(), and accelerate(). However, different types of vehicles (e.g., car, motorcycle, truck) might have different implementations for these methods. 1. Vehicle is an abstract base class defining a common interface for all vehicles, with abstract methods like start(), stop(), and accelerate(). 2. Car, Motorcycle, and Truck are concrete subclasses of Vehicle, each providing its own implementation for the abstract methods. 3. Each subclass can have its own specific attributes and methods, but they all must implement the methods defined in the Vehicle base class. below is the code..... from abc import ABC, abstractmethod class Vehicle(ABC): def __init__(self, speed=0, fuel=100): self.speed = speed self.fuel = fuel @abstractmethod def start(self): pass @abstractmethod def stop(self): pass @abstractmethod def accelerate(self): pass class Car(Vehicle): def start(self): print("Car started") def stop(self): print("Car stopped") def accelerate(self): print("Car accelerating") class Motorcycle(Vehicle): def start(self): print("Motorcycle started") def stop(self): print("Motorcycle stopped") def accelerate(self): print("Motorcycle accelerating") class Truck(Vehicle): def start(self): print("Truck started") def stop(self): print("Truck stopped") def accelerate(self): print("Truck accelerating") car = Car() car.start() car.accelerate() car.stop() motorcycle = Motorcycle() motorcycle.start() motorcycle.accelerate() motorcycle.stop() truck = Truck() truck.start() truck.accelerate() truck.stop()
Ok so if you need to create multiple class objects which all have something in common and which you need to imperatively implement because you will later need to call (such as obj.process() in this video), then you use an ABC class and enforce the child classes to all have the set of methods you want. That's what I understand.
Very informative video. I have one doubt. I don't agree with this statement - "An abstract method is a method that has a declaration but does not have a definition." We can define the abstract method and use it later with super function. Right?
Why does this code show an error from abc import ABC, abstractmethod class Computer(ABC): @abstractmethod def process(self): pass class Laptop(Computer): def process(self): print("Running") class Whiteboard(Computer): def write(self): print("Writing") class Program: def work(self, com): print("Working") com.process() c1 = Laptop() c2 = Whiteboard() p1 = Program() p1.work(c1) p1.work(c2) You didn't show the output after you changed whiteboard as a child class.
Respected and honourable sir ,i have been learning python from scratch only on your UA-cam channel. I wanna thank you from bottom of my heart.Till now i didn't face any problem or confusion.but now i was Little bit confused about the abstract class, why do we use and why do we need them. ***I have come up with a conclusion that : we use abstract classes and abstract method to override the abstract method again and again in other subclasses of abstract class.*** If it is correct? kindly reply.Big fan sir❤️...God bless you
This vid isn't clear at all. I only understood b/c I know abstract classes from C++, only then did I understand overriding abstract methods in child classes. Otherwise, the explanation is very unclear but he did show how to create and override abstract classes/methods at least using the custom library.
10:38 Whiteboard class extend Laptop class because it has the implication "definition" of the abstract method "process" otherwise we must implement "define" it inside the Laptop class. am I correct?
0:29 Lets open Pycharm. Me: So ain't you gonna define abstract class? Navin: In fact, the thing is we have to answer to questions here... He read my mind...😊...Have fun learning guys. Thank you sir for such nice tutorials.
Sir Assalam o alikum, i am watching your videos on blockchain and i am really very impressed how you explain everything in detail i have a question In hyperledger fabric there are 2 ways to reach consensus endosers and orders. What i am asking is who are endosers if they are admins Doesnt it make hyperledger centralized? Can i be an endoser?
Sir, could you do future videos on how to pass python certificiations, specifically the PCPP (Python institute professional certfied). By the way, brilliant instruction. Thanks
Actually I think abstract class and method is under the concept of method overriding and concept of inner class ..the commenters are confusing because of telusco didn't give any episode number or didn't connect with previous video because of it was uploaded in 2020 I think 😅
Sir this video is little confusing . I used computer inside whiteboard class then I should get the output right ? But I'm getting error that can't instantiate abstract calss whiteboard with abstract mathods process
Excellent Video on Python Abstract Class 🙌. I Appreciate your efforts 🙏, but I have below doubt? 🤔 from abc import ABC, abstractmethod import inspect class sample(ABC): def sam(self): pass print(inspect.isabstract(sample)) game = sample() OUTPUT---> False In the above example, we can see that the sample class inherits ABC (Abstract Base Class) but by using the inspect module of python it returns false as it doesn't have an abstract class and we are able to create a class from the sample class ------------------------------------------------------------------------------------------------------------------------------------ from abc import ABC, abstractmethod import inspect class sample(ABC): @abstractmethod def sam(self): pass print(inspect.isabstract(sample)) game = sample() OUTPUT---> True In the above example, we can see that the sample class inherits ABC (Abstract Base Class) and has one decorator abstract method sam by using the inspect module of python it returns True which is correct. ------------------------------------------------------------------------------------------------------------------------------------ Then is it necessary in python to became an Abstract class the class should inherit the extended ABC and at least have one abstract method?
as we are inheriting computer from abc, and laptop from computer its kinda like, multilevel inheritance, so...same error might repeat because laptop inherits computer which has an abstract method does inheriting an abstract class make the derived class, also an abstract class?
I have a doubt that, what is the significance of abstract method because method overloading and inheritance seems to be same as abstract classes... couldn't find the difference in between them...can you please help in this?
I am coding a sign language translation project. i am getting error "Process finished with exit code 134 (interrupted by signal 6: SIGABRT)". can you please help with this reply asap
Summary:
abstract method is a method which only has declaration and doesn't have definition.
a class is called abstract class only if it has at least one abstract method.
when you inherit a abstract class as a parent to the child class, the child class should define all the abstract method present in parent class.
if it is not done then child class also becomes abstract class automatically.
at last, python by default doesn't support abstract class and abstract method, so there is a package called ABC(abstract base classes) by which we can make a class or method abstract.
Dude... thank you! Very clear.
Love you, Dude
thank you
thanx bro
10 minutes video is awesome, 1 minute read paragraph is bravo!
for those who did not understand! assume a situation or an example (u r given a task to design some apps and an app to qualify it must and should contain some specific features like( brightness, notification ).so basically you can declare an abstract class with these feature declarations( brightness, notification ), but not the body in the abstract class and later u inherit them keeping in mind that while you are designing you must and should declare these feature's body for sure along with some more features and u might use the same abstract class for other app design because even it must also contain the specific features along with other, but the body declarations might change from class to class or an app to app if you are doing any real-time work).
hope u understood this
Essentially, you define abstract methods in an abstract class to ensure that it's child classes have a compulsion of having those methods defined inside them
Otherwise, the abstract method that is inherited by the child will make it an Abstract Base class thus preventing instantiation. So if we are to instantiate the child class, implementing the abstract methods becomes necessary.
we can find its usecase in design patterns
@@kunalpandey2066 Hi. Can you elaborate? Design patterns for designing what?
this explanation makes me understand its use i guess.
It's best to use, when we use polymorphism.
I see many are still confused with the concept and also with "how is it different from duck typing". Here is an example to get it cleared.
This is an exam 'hall' and there are students from 2 diffrent 'classes' seated. Class A has a maths test, Class B has social.
The invigilator says that to enter the hall, every one must carry an instrument box. Now students of classes both A and B must bring one even if B class don't have its use. So the class A will have a set of compass, rulers, pencils etc in it. But since students of class B don't have any use, they will just bring one with a pencil or even just empty (pass) because its compulsory to bring one in to be in the hall.
If a parent class has an abstract method, every child must also have one. So each child will have to define one of thier own.
In duck typing, It isn't necessary to define the parent class method for each child classes. it just simply have to point to the class where the particular method lies. Here we would have to define for each.
I hope this helps
Daymnnn 🤝🏻
Ok that was a clear explanation bro thanks now i understand its use
it was soooo confusing
Yes, not explained with good examples and details.
No
for those who did not understand! assume a situation or an example (u r given a task to design some apps and an app to qualify it must and should contain some specific features say brightness, notification .so basically you can declare an abstract class with these feature declarations but not the body and later u inherit them in keeping in mind that while design you must and should declare these feature's body for sure along with some more features and u might use the same abstract class for other app design because even it must also contain the specific features along with other but the body declarations might change from class to class or an app to app if you are doing any real-time work).
hope u understood this
@@sujithkumar_ga So I'm still trying to wrap my head around this. From what I'm seeing, using this video as the example, we declare process in the Computer class as an abstract method and therefore we get an error and to fix that error, we override it in a subclass, say Laptop, by redefining process. So then why even bother with the abstract method at all? Making the abstract method just seems like a waste of time if it's not going to do anything and I have to add the actual definition somewhere else.
@@vernanonix u will get to know better when u do real time projects 👍
Respected and honourable sir ,i have been learning python from scratch only on your UA-cam channel.
This video is quite confusing sir, can you please make one more so that we can understand this concept better.
Actually the video is very concise and clear
@@hyperskivo8426 yes
yeah... I felt irritated
@@hyperskivo8426 then tell me, why we need abstract class
@@ArjunKrishna-lx1re 🤣 Good question bro, I Think Navin has missing some logics and codes better we have to refer other utubers too , dont rely on him.
Probably need more explanation about this topic. Why we need to create abstract classes. But among all of the youtube videos, this is much much better than others. Thank you...
buddy, this is the best option we have...
and thats not a compliment.
from abc import *
class examhall:
@abstractmethod
def instrument_box(self):
pass
#'bring instrument box'
def water_bottle(self):
print('bring water bottle')
class students1(examhall):
def maths(self):
print('ok, i sure need one for the test')
#so let me define an instument box
def instrument_box(self):
print('pencils, compass, ruler etc')
class students2(examhall):
def social(self):
print('but i dont need one anyway')
#but since its compulsory, let me bring an empty one
def instrument_box(self):
print('empty box') #or just pass
s1 = students1()
s2 = students2()
s1.maths()
s1.instrument_box()
s2.social()
s2.instrument_box()
🎯 Key Takeaways for quick navigation:
00:00 *🖥️ Abstract Class and Abstract Method in Python*
- Understanding abstract classes and methods in Python.
- Abstract classes in Python are not directly supported but can be achieved using the ABC module.
- Abstract methods are defined without implementation and must be implemented by subclasses.
- Abstract classes cannot be instantiated and serve as templates for subclasses to implement methods.
03:18 *🛠️ Implementing Abstract Classes and Methods*
- Implementing abstract classes and methods using the ABC module.
- Importing the ABC module and using the `@abstractmethod` decorator to define abstract methods.
- Subclasses of abstract classes must implement all abstract methods.
- Attempting to instantiate an abstract class without implementing all abstract methods raises an error.
06:05 *🧩 Practical Application of Abstract Classes*
- Exploring the practical applications of abstract classes in object-oriented programming.
- Abstract classes provide a blueprint for subclasses to adhere to specific method implementations.
- Helps enforce a consistent structure across different subclasses.
- Useful for defining APIs or designing systems where certain methods must be implemented by subclasses.
Made with HARPA AI
You just implemented the exact thing that my teacher taugh me in my Object Oriented Design lecture...
Thank you so much for the video.....❤
Actually, the function of the abstract class is the programmer shouldn't be able to use a class and its method but he has to provide those methods and its definition to other inheriting classes. By using such a feature the programmer is forcing himself to provide different definitions in inheriting classes. Here what Navin is trying to say is all electronics like laptops desktops and mobiles are computers so the programmers must define all the parts like display and processor to all electronics like laptops desktops and mobiles because without such part they won't work
Thanks for this. Understood the concept but didn’t really get the “why.” This helps
Can you please explain more on why do we need abstract classes? It's not very clear to me.
This will be really helpful. Thanks!
It's a Object Oriented Programming thing. Maybe you are designing many classes and these classes share a common method (in teacher's example is processing(), so each time you inherit in a new class e.g. Laptop, it is mandatory/compulsory that you define processing() method there. I think it is a way to keep organized your OOP project.
When you have can possible have multiple(different) output/input, then you will need to create a base class(or abstract class) to use for multiple objects.
Simply, to follow a specific strict structure for the development of functionality.
no teacher teaches me that whiteboard example to explain the concept of abstraction,, your a genius sir..
Thanks a lot sir...please complete data structures and algorithms with python...and if possible start machine learning/data science..as u were telling earlier u we're about to start ...
yess yess yessss exactly
Yes sir
@@meghanadalal9837 haa yes
Yes sir please make it
1. Abstract base class desire its subclass or child class to instantiate the class object by inheriting its base class.
2. ABC methods require to its proceeding methods in a subclass to add the functionality.
3. ABC just def the methods but all its functionality will be designed by a subclass.
4. ABC customize the behaviour of isinstance() and issubclass()
Did you know ABC is what is called a "metaclass"?
Doubt
from abc import ABC,abstractmethod
class Computer(ABC):
@abstractmethod
def process(self):
pass
class Whiteboard(Computer):
def write(self):
print("Writing")
class Laptop:
def solve(self,com):
print("solving")
com.process()
com1=Whiteboard()
s=Laptop()
s.solve(com1)
"F:\PYthon oo\venv\Scripts\python.exe"
Traceback (most recent call last):
com1=Whiteboard()
TypeError: Can't instantiate abstract class Whiteboard with abstract methods process
you mean that if i use Whiteboard(Computer)
i must have process method in white board class so that only code works is n't ???
thats the use of abstract class
i hope you will reply soon.......
"If you can't explain a topic, you never understood it well" ~~ Someone
Einstein
Absolutely Brilliant Video! Thanks
Sorry i cant understand very well what u said about when is useful to use an abstract classs only with abstract methods? can you answer me that please
By the defination, abstraction is used to hide complexity of program but this defination doesn't seems appropriate in python implementation of abstraction.
For those if didnt understood properly go through below code
from abc import ABC, abstractmethod
class Shape(ABC):
@abstractmethod
def area(self):
pass
@abstractmethod
def perimeter(self):
pass
class Circle(Shape):
def __init__(self, radius):
self.radius = radius
def area(self):
return 3.14 * self.radius**2
def perimeter(self):
return 2 * 3.14 * self.radius
class Square(Shape):
def __init__(self, side):
self.side = side
def area(self):
return self.side**2
def perimeter(self):
return 4 * self.side
1) here trying to directly instantiate shape will directly result in error as it is defined by abstract
2) here we have declared the area, perimeter as abstract , so any class that inherits shape class were forced to define those methods (or ) will result in error....reason why i did this is for any shape, ie square, rectangle, circle....calculating area and perimeter are important.
super cool!😺
nice
where is your energy man in this tutorial?
Btw, U r awesome...
nice explanation in udemy
I am pretty much sure I have missed something, but I am not sure what it is.At 5:11 - I got the concept that if you inherit an Abstract class, the child class will also be Abstract. That I understood, tried and was successful.
But didn't properly get the concept after that. If the parent class is an Abstract Class, and if the child class has its own methods, the methods of the child class run without a problem. Have I got it right?
Thanks for making such helpful video for learners. But I either was not able to understand the ABC concept of class & method by watching this video or video missed the good example of this. Thanks to chatGPT it gave me below real world example which explains the concept really well.
e.g. a vehicle might have common attributes like speed, fuel, and methods like start(), stop(), and accelerate(). However, different types of vehicles (e.g., car, motorcycle, truck) might have different implementations for these methods.
1. Vehicle is an abstract base class defining a common interface for all vehicles, with abstract methods like start(), stop(), and accelerate().
2. Car, Motorcycle, and Truck are concrete subclasses of Vehicle, each providing its own implementation for the abstract methods.
3. Each subclass can have its own specific attributes and methods, but they all must implement the methods defined in the Vehicle base class.
below is the code.....
from abc import ABC, abstractmethod
class Vehicle(ABC):
def __init__(self, speed=0, fuel=100):
self.speed = speed
self.fuel = fuel
@abstractmethod
def start(self):
pass
@abstractmethod
def stop(self):
pass
@abstractmethod
def accelerate(self):
pass
class Car(Vehicle):
def start(self):
print("Car started")
def stop(self):
print("Car stopped")
def accelerate(self):
print("Car accelerating")
class Motorcycle(Vehicle):
def start(self):
print("Motorcycle started")
def stop(self):
print("Motorcycle stopped")
def accelerate(self):
print("Motorcycle accelerating")
class Truck(Vehicle):
def start(self):
print("Truck started")
def stop(self):
print("Truck stopped")
def accelerate(self):
print("Truck accelerating")
car = Car()
car.start()
car.accelerate()
car.stop()
motorcycle = Motorcycle()
motorcycle.start()
motorcycle.accelerate()
motorcycle.stop()
truck = Truck()
truck.start()
truck.accelerate()
truck.stop()
Please make videos on Python Projects
excellent sir
ok i understand the concept of abstract but i don't understand the actual use of abstract.
wonderful sir, great tutorial, thank you
It had taken me 1 hr to properly understand this one....but finally i felt the example was cool. Thank you Sir.
Many many thanks for posting the missed leathers of python. We are waiting for it👌👌👌👌😋😋
wait ! what? you called me alien? i liked though
Good Explanation !
Your grate sir thank so much
Thank You So Much Sir.
4:50 I expect it to work, because we are creating an object of a concrete rather than abstract class
Ok so if you need to create multiple class objects which all have something in common and which you need to imperatively implement because you will later need to call (such as obj.process() in this video), then you use an ABC class and enforce the child classes to all have the set of methods you want. That's what I understand.
Bye Bye is an emotion ❤
Very informative video. I have one doubt. I don't agree with this statement - "An abstract method is a method that has a declaration but does not have a definition."
We can define the abstract method and use it later with super function. Right?
You can
Sir your specticulars are nice today
"interfaces" module will more good representation than abc module....
Not the same.
Why does this code show an error
from abc import ABC, abstractmethod
class Computer(ABC):
@abstractmethod
def process(self):
pass
class Laptop(Computer):
def process(self):
print("Running")
class Whiteboard(Computer):
def write(self):
print("Writing")
class Program:
def work(self, com):
print("Working")
com.process()
c1 = Laptop()
c2 = Whiteboard()
p1 = Program()
p1.work(c1)
p1.work(c2)
You didn't show the output after you changed whiteboard as a child class.
This video made me realize the significance of duck typing.
Yea ikr. I didnt get what is abs is tbh with this video. it feels like extension of Duck typing video
Thank you very much!
Could you try different examples like Pizza, Burger instead of the Computer, please?
Respected and honourable sir ,i have been learning python from scratch only on your UA-cam channel.
I wanna thank you from bottom of my heart.Till now i didn't face any problem or confusion.but now i was Little bit confused about the abstract class, why do we use and why do we need them.
***I have come up with a conclusion that : we use abstract classes and abstract method to override the abstract method again and again in other subclasses of abstract class.***
If it is correct? kindly reply.Big fan sir❤️...God bless you
Please make lectures on Data Analytics and ML
The concept is actually tough to understand here if we don't have basic understanding of Java abstract class.. But very nicely explained. ❤🎉
This vid isn't clear at all. I only understood b/c I know abstract classes from C++, only then did I understand overriding abstract methods in child classes. Otherwise, the explanation is very unclear but he did show how to create and override abstract classes/methods at least using the custom library.
Loved this video! Good explanation , good job.
At 9:51 my output comes only 'solving bugs'..that com.process is not executing..i dont understand what is happening and there is no error showing
Previous background was waaaayyyyyy better
10:38 Whiteboard class extend Laptop class because it has the implication "definition" of the abstract method "process" otherwise we must implement "define" it inside the Laptop class. am I correct?
Thanks sir for working for us
@4:38 : No, it won't work. The class that inherits an abstract class is also an abstract class and can't be instantiated.
thank you very much sir for this video
Sir , make a video on metaclass, why it is used and implementation details..
0:29 Lets open Pycharm.
Me: So ain't you gonna define abstract class?
Navin: In fact, the thing is we have to answer to questions here...
He read my mind...😊...Have fun learning guys.
Thank you sir for such nice tutorials.
sir...please makes video on data structures and algorithms with python please please
Sir Assalam o alikum,
i am watching your videos on blockchain and
i am really very impressed how you explain everything in detail i have a question
In hyperledger fabric there are 2 ways to reach consensus endosers and orders. What i am asking is who are endosers if they are admins Doesnt it make hyperledger centralized? Can i be an endoser?
Ve aleykumselam
Sir, could you do future videos on how to pass python certificiations, specifically the PCPP (Python institute professional certfied). By the way, brilliant instruction. Thanks
Sir, please make video on data structure and algorithm in python
yes sir...
Actually I think abstract class and method is under the concept of method overriding and concept of inner class ..the commenters are confusing because of telusco didn't give any episode number or didn't connect with previous video because of it was uploaded in 2020 I think 😅
sir please bring up a series of python for intermediate
Thank you
The println macro at 7:35, you had been writing Rust haha
Great explaination, but can you please differentiate between inheritance and abstraction. Anyone can answer to it to spread knowledge. Thanks.
Can we expect a video, explaining Django 3.0 new features..? and advance stuff like cookies and sessions in Django.?
yes i have exact same question
Please add video for encapsulation concept(__x) to restrict input.
Thanks!
Need more clarity on Abstract Class and Methods
Sir this video is little confusing . I used computer inside whiteboard class then I should get the output right ? But I'm getting error that can't instantiate abstract calss whiteboard with abstract mathods process
Excellent Video on Python Abstract Class 🙌.
I Appreciate your efforts 🙏, but I have below doubt? 🤔
from abc import ABC, abstractmethod
import inspect
class sample(ABC):
def sam(self):
pass
print(inspect.isabstract(sample))
game = sample()
OUTPUT---> False
In the above example, we can see that the sample class inherits ABC (Abstract Base Class) but by using the inspect module of python it returns false as it doesn't have an abstract class and we are able to create a class from the sample class
------------------------------------------------------------------------------------------------------------------------------------
from abc import ABC, abstractmethod
import inspect
class sample(ABC):
@abstractmethod
def sam(self):
pass
print(inspect.isabstract(sample))
game = sample()
OUTPUT---> True
In the above example, we can see that the sample class inherits ABC (Abstract Base Class) and has one decorator abstract method sam by using the inspect module of python it returns True which is correct.
------------------------------------------------------------------------------------------------------------------------------------
Then is it necessary in python to became an Abstract class the class should inherit the extended ABC and at least have one abstract method?
Did he just call me an alien?
nothing understood during the last part of video please make a video on this again
Hi @Telisko , Which video editing tool you use ?
camtasia studio
Upload a videos on boto3 please
can a non abstract class have abstract methods in python ..in java,c++ its not but what about python
Sir please make another video about abstraction class and method..it's too confusing.
Can you make a video on infrastructure automation using powershell and python
Thanks for making easy, understanding videos on python. But this one was a bit confusing for non IT people like me!!! Anyways thanks :-)
as we are inheriting computer from abc, and laptop from computer
its kinda like, multilevel inheritance, so...same error might repeat because laptop inherits computer which has an abstract method
does inheriting an abstract class make the derived class, also an abstract class?
I have a doubt that, what is the significance of abstract method because method overloading and inheritance seems to be same as abstract classes... couldn't find the difference in between them...can you please help in this?
Sir it's confusing 😐😐 please make another video for abstract classes and methods 🙏🙏 @Telusko
Yes it will work, if in inherits
#pytutor Really Helpful..
I heard goosebumps in whole video
Was it only me
Thank you sir....please do a video on dataclasses in python3.5 and onwards...
can you please help with practice problems to go through th concept abstract class
What are the benefits of Abstract class?
Why do we use it ??
Is this done to achieve abstraction from oops concept , please I need answer
My eyes are burning. Does search and rescue use your IDE as a floodlight?
plzz make a series on REST API details on python with a hands-on project
what is difference between interface and abstract class,getting confused on this abstract class and method concept
Is it necessary to implement all the abstract methods in a single sub class??
I am coding a sign language translation project. i am getting error "Process finished with exit code 134 (interrupted by signal 6: SIGABRT)". can you please help with this reply asap
Thanks for the short explanation!
perfect
Under the class whiteboard. It should be process(self) not write to run the programme.