I’m getting the error “circular inheritance problem encountered in ‘atan'” on the last line. I’m confused since it only occurs in that line and not in main(). I only include in the cpp file and not anywhere else. Since the error is only in the class function I guess I’m doing something wrong with the class, but can’t figure out what it is.
*I only threw in the main as an example of when it works. Doesn’t actually serve a purpose.
//.h file
#ifndef CIRCLE_H_
#define CIRCLE_H_
class Circle {
public:
Circle(int minVertex=12);
~Circle();
private:
int pixels;
};
#endif /* CIRCLE_H_ */
// cpp file
#include <circles.h>
#include <cmath>
using namespace std;
int main(){
double pi = abs(9);
}
Circle::Circle(int minVertex = 12) {
pixels = 1150;
double pi = atan(0) *2; // problem here
}
You have a class that inherits from itself, how could that work?