-
Notifications
You must be signed in to change notification settings - Fork 31
Extending Objects Notes
mrseidel edited this page Aug 29, 2024
·
1 revision
There are multiple ways to save time and force cohesion between different programmers: Inheritance, Interfaces, and Abstract Classes. Short description of each below.
| Type of Extension | Main Benefit | Language Specific Information |
|---|---|---|
| Inheritance | Full access to parent class | C++, C#, Java, Kotlin, Python, JavaScript and Processing all have support for this. Out of the list, only Python allows for multiple-inheritance (usually more difficult to work with) |
| Interfaces | Create a template of methods Seen as a "contract" |
C#, Java, Kotlin and Processing have support for this. This is a work-around to the multiple-inheritance problem, and helps programmers to conform to a standard. Python and JavaScript do not support interfaces. |
| Abstract Classes | Like interfaces; however, you can create the body of functions and instance variables | C++, C#, Java, Kotlin, Python, and Processing all support abstract classes. JavaScript does not support abstract classes natively. There are design patterns that allow JavaScript to act like it has abstract classes (see example here). |
| Language | Resource |
|---|---|
| C++ | Inheritance^, Interfaces^, Abstract Classes^ |
| C# | Inheritance, Interfaces, Abstract Classes^ |
| Java | Inheritance, Interfaces, Abstract Classes |
| JavaScript | Inheritance, Abstract Classes^ |
| Python | Inheritance, Abstract Classes |
^ No external videos/resources found for these (if you find one, let me know and I will update this listing).