![](/media/cache/profiles/c3d4543d921d3fc90cabc2c864c68276.jpg.50x50_q85.jpg)
exercises
main.cpp@0:ff7b10a0e08f, 2015-08-28 (annotated)
- Committer:
- Jamess
- Date:
- Fri Aug 28 18:45:26 2015 +0000
- Revision:
- 0:ff7b10a0e08f
Trying to learn;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Jamess | 0:ff7b10a0e08f | 1 | //Aprender: |
Jamess | 0:ff7b10a0e08f | 2 | // |
Jamess | 0:ff7b10a0e08f | 3 | //ponteiro de ponteiro; |
Jamess | 0:ff7b10a0e08f | 4 | //ponteiro de ponteiro para uma classe; |
Jamess | 0:ff7b10a0e08f | 5 | //Classes dinamicamente alocadas (usando * = new) |
Jamess | 0:ff7b10a0e08f | 6 | |
Jamess | 0:ff7b10a0e08f | 7 | //static keyword; |
Jamess | 0:ff7b10a0e08f | 8 | //returning pointer;. |
Jamess | 0:ff7b10a0e08f | 9 | //virtual function; |
Jamess | 0:ff7b10a0e08f | 10 | //Criar argumentos para passar para a função criada; |
Jamess | 0:ff7b10a0e08f | 11 | |
Jamess | 0:ff7b10a0e08f | 12 | #include "mbed.h" |
Jamess | 0:ff7b10a0e08f | 13 | #include "fruits.h" |
Jamess | 0:ff7b10a0e08f | 14 | #include "cook.h" |
Jamess | 0:ff7b10a0e08f | 15 | |
Jamess | 0:ff7b10a0e08f | 16 | Serial pc(USBTX,USBRX); |
Jamess | 0:ff7b10a0e08f | 17 | |
Jamess | 0:ff7b10a0e08f | 18 | int main() { |
Jamess | 0:ff7b10a0e08f | 19 | |
Jamess | 0:ff7b10a0e08f | 20 | fruits* catpt = new fruits[10]; |
Jamess | 0:ff7b10a0e08f | 21 | fruits* pt; |
Jamess | 0:ff7b10a0e08f | 22 | pt = catpt; |
Jamess | 0:ff7b10a0e08f | 23 | |
Jamess | 0:ff7b10a0e08f | 24 | cook jarbas; |
Jamess | 0:ff7b10a0e08f | 25 | |
Jamess | 0:ff7b10a0e08f | 26 | while(1) { |
Jamess | 0:ff7b10a0e08f | 27 | |
Jamess | 0:ff7b10a0e08f | 28 | jarbas.makeBanana(&pc,&pt); |
Jamess | 0:ff7b10a0e08f | 29 | wait(0.1); |
Jamess | 0:ff7b10a0e08f | 30 | } |
Jamess | 0:ff7b10a0e08f | 31 | } |
Jamess | 0:ff7b10a0e08f | 32 |