How to get around C2665 error

I keep getting this error and I would like to know how to disable it. What I am doing is weird and the code speaks for itself.


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42

//The full class is not written out btw didn't want to confuse you with
//all the other code
class Sprite 
{
public:
    virtual ~Sprite () {}

    virtual const Sprite* GetObj() const = 0;
};

class Circle: public Base {
public:
    virtual const Circle* GetObj() const {
        return this;
    }
};

class Square: public Base {
public:
    virtual const Square* GetObj() const {
        return this;
    }
};

//these functions will be called
float CheckCollision(const Circle &cir1, const Circle &cir2);
float CheckCollision(const Circle &cir, const Square &sqr);
float CheckCollision(const Square &sqr1, const Square &sqr2);
float CheckCollision(const Square &sqr, const Circle &cir);
float CheckCollision(const Square &sqr, const Vector2 &vect);
float CheckCollision(const Circle &cir, const Vector2 &vect);  

// compiler wants me to also have
// float CheckCollision(const Sprite &spr, const Sprite &spr2);
// but this function will never get called

//so if I do something like this

float pen = CheckCollision(*sprite[i]->GetObj(),*sprite[j]->GetObj());



I am just curious if this is possible
Can you post the actual error message? Most of us don't have the error codes memorized. Plus the error message tells you other things like the actual line number that the error is on, what symbol is causing the problem, etc, etc.
Topic archived. No new replies allowed.