Exemple d'initialisation variable (polymorphisme)
main.cpp
- Committer:
- YROY2004
- Date:
- 2018-02-14
- Revision:
- 0:1e0b34f02f01
File content as of revision 0:1e0b34f02f01:
//code dérivé du code présenté dans le document 2018-01 247-436 D-0015 M2-S4-TH (powerpoint)
#include "mbed.h"
#include "maClasseToggle.h"
int main() {
uint16_t retour;
DigitalOut monLED(LED1);
maClasseToggle monObjetToggle1;
maClasseToggle monObjetToggle2(1);
printf("initialisation\n");
retour = monObjetToggle1.retourneStatut();
printf("statut 1: %d\n", retour);
retour = monObjetToggle2.retourneStatut();
printf("statut 2: %d\n", retour);
while(1) {
monObjetToggle1.toggle();
retour = monObjetToggle1.retourneStatut();
printf("statut 1: %d\n", retour);
monLED = retour;
wait(1);
}
}