Skip to content

Commit

Permalink
Add polymorphism
Browse files Browse the repository at this point in the history
  • Loading branch information
tony-maulaz committed Feb 8, 2022
1 parent bb4ec5e commit 4ddc385
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,7 @@
- [constructeur.md](https://github.com/tony-maulaz/poo-exercices/blob/main/ex50-constructeur.md)

## Ex 60 - Heritage
- [heritage.md](https://github.com/tony-maulaz/poo-exercices/blob/main/ex60-heritage.md)
- [heritage.md](https://github.com/tony-maulaz/poo-exercices/blob/main/ex60-heritage.md)

## Ex 70 - Polymorphisme
- [polymorphism.md](https://github.com/tony-maulaz/poo-exercices/blob/main/ex70-polymorphism.md)
19 changes: 19 additions & 0 deletions ex70-polymorphism.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Ex 1

- Créer une classe `Animal` qui contient une méthode `speak`.
- Créer une classe `Dog` qui affiche `Wouf` sur la console lorsque la méthode
`speak` est appelée.

Le code suivant doit fonctionner.

```cpp
#include <iostream>
using namespace std;

int main()
{
cout << "The dog is here" << endl;
Animal* a = new Dog();
a->speak();
}
```

0 comments on commit 4ddc385

Please sign in to comment.