1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
|
#include <iostream>
using namespace std;
class MaClasse
{
public:
MaClasse ( const int nbElements, float * tab)
{
this->nbElements = nbElements;
vertices = new float[nbElements];
for ( int i = 0; i< nbElements; i++)
vertices[i] = tab[i];
this->draw();
}
~MaClasse()
{
delete[] vertices;
}
void draw()
{
for ( int i = 0; i< nbElements; i++)
cout << vertices[i] << " | ";
}
protected:
float *vertices;
float nbElements;
};
int main ()
{
float tab [] = {0,0,50, -15, 10, 50, 5, 15,50, 15, 10,50, 10,0,50};
MaClasse var(5, tab);
return 0;
} |
Partager