R
Remi Ricard
Hi,
This is a code that reproduce my problem.
#include <stdio.h>
class A {
public:
virtual int get(int a)=0;
int get(float a) {return 1;}
};
class B : public A {
public:
virtual int get(int a) { return 2; }
};
void main()
{
B b;
printf("b->get(12)=%d b->get(1.234)=%d\n", b.get(99), b.get(1.234));
}
The output is:
b->get(12)=2 b->get(1.234)=2
Why the second call b.get(1.2.3.4) don't call the function A::get(float) ??
I think, I have a conversion from float to int then the function
B::get(int) is called. Why ??
Remi Ricard
(e-mail address removed)
This is a code that reproduce my problem.
#include <stdio.h>
class A {
public:
virtual int get(int a)=0;
int get(float a) {return 1;}
};
class B : public A {
public:
virtual int get(int a) { return 2; }
};
void main()
{
B b;
printf("b->get(12)=%d b->get(1.234)=%d\n", b.get(99), b.get(1.234));
}
The output is:
b->get(12)=2 b->get(1.234)=2
Why the second call b.get(1.2.3.4) don't call the function A::get(float) ??
I think, I have a conversion from float to int then the function
B::get(int) is called. Why ??
Remi Ricard
(e-mail address removed)