User Tools

Site Tools


notes:cprog:fall2021:projects:oop2

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
notes:cprog:fall2021:projects:oop2 [2021/11/10 05:15] – [References] hhemlernotes:cprog:fall2021:projects:oop2 [2021/11/11 04:58] (current) – [References] hhemler
Line 132: Line 132:
  
 Parent child relationships refer to base classes and the derived classes that inherit from them.  In regards to polymorphism, this means, that the derived classes are not simply inheriting attributes or methods, but using them in different ways.  The methods and attributes being inherited still depends on that element's access control label. Parent child relationships refer to base classes and the derived classes that inherit from them.  In regards to polymorphism, this means, that the derived classes are not simply inheriting attributes or methods, but using them in different ways.  The methods and attributes being inherited still depends on that element's access control label.
 +
 +Inheritance lets us inherit attributes and methods from another class. Polymorphism uses those methods to perform different tasks.
 +====Similarities to word origins====
 +It is strange that what is called 'polymorphism' in C++ is called such. Polymorph's word structure would imply multiple shapes, and polymorph in common fantasy/magical settings often relates to something temporarily transforming into a different creature, or shape. This has no relation to the C++ polymorph, which mainly relates to a child class changing an already existing function of its parent classes. It seems that mutation or evolution would be a better term, as if a creature inherited something from its ancestors, such as eyes, and then the child some genetic variation that caused its eyes to be more effective at seeing, that would be a mutation or evolution, we would not call such a thing polymorphing.
 +
 +COOL BUG FACT: After writing this I found that "polymorph" and "polymorphism" have two very different meanings. Polymorphism is the occurrence of different forms among members of a colony, meaning everything I wrote above this is kinda wrong...
 +
 +RELEVANT COOL BUG FACT: If the child class has a child of its own, the polymorphed version of functions will be what the child's child inherits
 =====Program===== =====Program=====
 Write a program that makes use of polymorphism. It can be anything, so long as you genuinely implement it and it works. Write a program that makes use of polymorphism. It can be anything, so long as you genuinely implement it and it works.
Line 147: Line 155:
   * https://www.tutorialspoint.com/cplusplus/cpp_overloading.htm   * https://www.tutorialspoint.com/cplusplus/cpp_overloading.htm
   * https://www.mygreatlearning.com/blog/polymorphism-in-cpp/   * https://www.mygreatlearning.com/blog/polymorphism-in-cpp/
 +  * https://www.javatpoint.com/cpp-virtual-function
 =====Submission===== =====Submission=====
 I'll be looking for the following: I'll be looking for the following:
notes/cprog/fall2021/projects/oop2.1636521339.txt.gz · Last modified: 2021/11/10 05:15 by hhemler