updated Vector

git-svn-id: svn://anubis/gvsu@357 45c1a28c-8058-47b2-ae61-ca45b979098e
This commit is contained in:
josh 2009-01-16 00:55:28 +00:00
parent 19c0d09096
commit cba45f29a2
2 changed files with 36 additions and 0 deletions

View File

@ -0,0 +1,16 @@
#include "Vector.h"
#include <iostream>
Vector::Vector()
{
m_array[0] = 0.0;
m_array[1] = 0.0;
m_array[2] = 0.0;
}
std::ostream & operator<<(std::ostream & out, const Vector & v)
{
out << "[" << v[0] << ", " << v[1] << ", " << v[2] << "]";
return out;
}

View File

@ -0,0 +1,20 @@
#ifndef VECTOR_H
#define VECTOR_H VECTOR_H
#include <iostream>
class Vector
{
public:
Vector();
~Vector();
double & operator[](int idx) { return m_array[idx]; }
double operator[](int idx) const { return m_array[idx]; }
friend std::ostream & operator<<(std::ostream & out, const Vector & v);
private:
double m_array[3];
};
#endif