This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
notes:cprog:fall2021:projects:oop2 [2021/11/10 04:40] – [Parent-Child Relationships] toverhi1 | notes:cprog:fall2021:projects:oop2 [2021/11/11 04:58] (current) – [References] hhemler | ||
---|---|---|---|
Line 24: | Line 24: | ||
===Compile Time Polymorphism=== | ===Compile Time Polymorphism=== | ||
Compile time polymorphism is achieved by overloading. This can be in the form of operator overloading, | Compile time polymorphism is achieved by overloading. This can be in the form of operator overloading, | ||
+ | |||
+ | Overloading is takes place when more than one function or operator, with the same name and scope, are given differing definitions. | ||
+ | |||
+ | It is called compile-time polymorphism because a function is called at the time of program compilation. | ||
==Template Functions== | ==Template Functions== | ||
Line 68: | Line 72: | ||
===Run Time Polymorphism=== | ===Run Time Polymorphism=== | ||
Run time polymorphism is achieved by overriding. Overriding occurs when a child class redefines a parent class' | Run time polymorphism is achieved by overriding. Overriding occurs when a child class redefines a parent class' | ||
+ | |||
+ | In a runtime polymorphism, | ||
==Virtual Functions== | ==Virtual Functions== | ||
Line 125: | Line 131: | ||
====Parent-Child Relationships==== | ====Parent-Child Relationships==== | ||
- | Parent child relationships refer to base classes and the derived classes that inherit from them. In regards to polymorphism, | + | Parent child relationships refer to base classes and the derived classes that inherit from them. In regards to polymorphism, |
+ | |||
+ | 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 ' | ||
+ | |||
+ | COOL BUG FACT: After writing this I found that " | ||
- | The methods and attributes being inherited still depends on that element' | + | RELEVANT COOL BUG FACT: If the child class has a child of its own, the polymorphed version of functions will be what the child' |
=====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 140: | Line 152: | ||
* https:// | * https:// | ||
* https:// | * https:// | ||
+ | * https:// | ||
+ | * https:// | ||
+ | * https:// | ||
+ | * https:// | ||
=====Submission===== | =====Submission===== | ||
I'll be looking for the following: | I'll be looking for the following: |