From 96a5da74900ca72ea18d7102075c1e7143e64078 Mon Sep 17 00:00:00 2001 From: Maulaz Tony Date: Tue, 8 Feb 2022 16:22:26 +0100 Subject: [PATCH] Add exercice construction --- ex50-constructeur.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/ex50-constructeur.md b/ex50-constructeur.md index 4684b29..77efc0c 100644 --- a/ex50-constructeur.md +++ b/ex50-constructeur.md @@ -142,4 +142,29 @@ int main() Test t(2.34, 12,8); t.plot(); } +``` + +# Ex 5 +Quel est l'affichage du programme suivant ? + +```cpp +#include +using namespace std; + +struct Test{ + Test(){ cout << "Test is construct" << endl; } +}; + +int main() +{ + cout << "Test construction" << endl; + cout << "Case 1" << endl; + Test t[3]; + + cout << "Case 2" << endl; + Test* pt[3]; + + cout << "Case 3" << endl; + pt[0] = new Test(); +} ``` \ No newline at end of file