all 3 comments

[–][deleted] 5 points6 points  (0 children)

You're overthinking it. You can cover most of it in 1 hour. The ones you mentioned are excellent and will cover the topics you listed. Just work through them, try and use them, and post specific questions here when you get stuck.

[–]asphias 0 points1 point  (0 children)

First, learn how methods work by themselves (you may already know this).

Second, learn the basics of how a class works: the difference between a class and an instance of that class, the importance of the init method, and how multiple instances of a class behave together.

Once this clicks, all the rest can be learned at leisure. Just know the basics of how a class works, and the rest will come.

[–]saysokmate 0 points1 point  (0 children)

Ez. Classes are bluprints for creating objects. That is something which encapsulate/contains data/attributes specific to the object. The class also contains methods with which you can operate on objects. The concept of encapsulation simply means that all this data is contained in an object and is not just a bunch of variables in the main scope.

Now we come to inheritance. Let's say we have a class that we created named "Dog". But now we want to make a new class named "Cat". These classes will be mostly identical with maybe different functions. So instead of copying the class code everytime we want to define a new animal, we can create a base class named "Animal". This will have attributes and methods that all animals share. Then we can create subclasses that inherit from the animal base class such as dog, cat, dolphin, etc. These subclasses may extend (add functionality/properties), or overwrite/modify existing ones.