-   
- #include <stdio.h> 
- #include <vector> 
-   
- struct unidad 
- { 
-     int x; 
-     int y; 
-     int w; 
-     int h; 
-     int color; 
-     int tipoUnidad; 
-     int numeroUnidad; 
-     bool movimiento; 
-   
-     unidad() : x(600), y(400), w(10), h(10), color(6), tipoUnidad(1), numeroUnidad(1), movimiento(true) 
-     { 
-         printf("Creando unidad: 0x%pn", this); 
-     }; 
-   
-     ~unidad() 
-     { 
-         printf("Eliminando unidad: 0x%pn", this); 
-     }; 
- }; 
-   
- typedef std::vector<unidad*> Ejercito; 
-   
- void main() 
- { 
-     Ejercito v; 
-     v.push_back(new unidad()); 
-     v.push_back(new unidad()); 
-     v.push_back(new unidad()); 
-     v.push_back(new unidad()); 
-     // Destruir elementos del vector 
-     Ejercito::iterator it; 
-     for (it = v.begin(); it != v.end(); it++) delete *it; 
-   
-     unidad u; 
-     printf("Color de unidad u: %u n", u.color); 
- } 
-   
-