I want to declare a class for Coordinates and I try this codes:
Coordinate.h:
typedef unsigned short Short; class Coordinate { private : Short _row; Short _col; public: Coordinate(Short row, Short col); bool operator ==(const Coordinate* other); };
Coordinate.cpp:
#include "Coordinate.h" Coordinate::Coordinate(Short row, Short col) : _row(row) , _col(col){} bool Coordinate::operator== (const Coordinate* other) { if (other == NULL || this == NULL) return false; if (this == other) return true; if (other->_row != this->_row || other->_col != this->_col) return false; return true; }
Main.cpp :
#include "Coordinate.h" int main() { Coordinate a( 2,2 ); }
But visual studio 2015 returns this errors:
Error C2079 'a' uses undefined class 'Coordinate'
Error C2440 'initializing': cannot convert from 'initializer list' to 'int'