Start New Discussion within our Software Development Community

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

This question has already been answered. Start a new discussion instead.