A Hundred Days of Code, Day 004 - Class Attributes and Inheritance
Learnt about Class Attributes and Inheritance, today. Notes The way we write functions/methods and define classes might look similar, class CrazyTalk(object): and def how_now_brown_cow(): The way they behave/execute, though is wildly different. Classes run / spring to life as soon as the program launches. Functions don’t, unless they are called. Realised that objects are containers. What you can do with the object depends on what is in it. Does it hold a dictionary with various methods to modify it? Does it just hold a bunch of text? Reminds me of media formats as containers. A mp4 file is not just an mp4 file. The video resolution could vary from one file to another. The type of audio encoding could be different. It could carry multiple streams of audio or video or other metadata. What you can do with the file or where you can play it, depends on what is inside it. Same with classes and objects. ...