Question on getting my class to work with a project I am working on

oldY = changeY1(pos1[0]);

I call the changeY1 function in my main and am setting a int = to the value returned,I am declaring this function in a seperate class of its own :

#ifndef INTERVAL_H
#define INTERVAL_H

#include <iostream>


class Cords
{
public:

  int changeY1 (char y1);

  int changeX1 (char x1);

  int changeY2 (char y2);

  int changeX2 (char x2);
};
#endif

int Cords::changeY1(char y1)
{
    int oldY;

      if(y1 == '1')
       oldY = 1;
      else
      if(y1 == '2')
       oldY = 2;
      else
      if(y1 == '3')
       oldY = 3;
      else
      if(y1 == '4')
       oldY = 4;
      else
      if(y1 == '5')
       oldY = 5;
      else
      if(y1 == '6')
       oldY = 6;
      else
      if(y1 == '7')
       oldY = 7;

return oldY;
}

Though I keep recieving an error when compiling main saying that changeY1 was not declared in this scope, I did include the .h file

What is #ifndef INTERVAL_H did you include it?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.