Skip to content

Instantly share code, notes, and snippets.

@kybernetyk
Created November 17, 2009 16:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kybernetyk/237011 to your computer and use it in GitHub Desktop.
Save kybernetyk/237011 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <vector>
class Vector2D
{
public:
int getX (void);
void setX (int _x);
Vector2D ();
~Vector2D ();
private:
int x;
};
Vector2D::Vector2D ()
{
}
Vector2D::~Vector2D ()
{
}
int Vector2D::getX (void)
{
return x;
}
void Vector2D::setX (int _x)
{
x = _x;
}
int main (int argc, const char * argv[])
{
// insert code here...
printf("Hello, World!\n");
std::vector <Vector2D> array;
Vector2D myVec;
myVec.setX(12);
array.push_back (myVec);
std::vector <Vector2D>::iterator it = array.begin();
while (it != array.end())
{
//referenz
Vector2D &myVec = *it;
//direkt objekt cast
//Vector2D myVec = (Vector2D)(*it);
printf("des vektors x: %i\n",myVec.getX());
it ++;
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment