+ 1

Classes in Python

Hi, I have just done the class in oop in the Pyrhon core, but I could not understand them, especially the method part, I could not understand why they are used. Can somebody please explain me what a class is and why they ate used with an example? Thank you

1st Aug 2022, 9:00 AM
Danish Zubair
Danish Zubair - avatar
2 Respostas
+ 4
Danish Zubair Any examples of class will only be a repitition of the lessons you have already reviewed. Methods in a class are the same as definitions. They don't act upon the internal code unless called. But you can have multiple methods with the same name in a code, for example talk() If you ask a dog to talk, you expect to hear 'woof' If you ask a cat to talk, you expect to hear 'meow'. So Classes have embedded methods that will return the expected response when you call the method through the class. Review the lessons again for a better understanding. I have done it 3 times already and am still learning
1st Aug 2022, 9:54 AM
Rik Wittkopp
Rik Wittkopp - avatar
+ 3
Rik Wittkopp ok, thank you
1st Aug 2022, 10:03 AM
Danish Zubair
Danish Zubair - avatar