Candace Eckels
Posted on March 23, 2023
I've learned that the major difference between these to tools is the use case. Inheritance I will use if I need to instantiate a class and then the next class I use builds off that previous class(I want it to mimic a 'parent-child' relationship). Whereas modules I would use when I didn't need to instantiate and instance.
I have found that this is best used for calculations that are used across multiple classes. An example might be a total calculation. That can be used in multiple classes. Instead of writing out this total calculation for every class I need it in I can create a module that holds my method and then have my classes call on that one total method to find my totals.
If you wanna checkout my project click here!
Posted on March 23, 2023
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.