R
Ruud van Gaal
Hi,
I'm probably wrong at this, but can't understand the following:
I have 2 separate modules, mod1.cpp and mod2.cpp:
--- mod1.cpp ---
#include <stdio.h>
void mod2();
class A
{
public:
void f()
{
printf("mod1:A:f\n");
}
};
void main()
{
A a;
a.f();
mod2();
}
--- mod2.cpp ---
#include <stdio.h>
class A
{
public:
void f()
{
printf("mod2:A:f\n");
}
};
void mod2()
{
A a;
a.f();
}
---
Notice the local class A which inlines its functions. When running
this, I get:
mod1:A:f
mod1:A:f
instead of my expected:
mod1:A:f
mod2:A:f
The mod2.cpp's A:f() function is ignored and mod1.cpp:A::f() is called
instead!? Anybody have an explanation?
I tried this on MSVC6, MSVC7.1 and g++4.0; all exhibit the same
behavior.
Thanks,
Ruud
I'm probably wrong at this, but can't understand the following:
I have 2 separate modules, mod1.cpp and mod2.cpp:
--- mod1.cpp ---
#include <stdio.h>
void mod2();
class A
{
public:
void f()
{
printf("mod1:A:f\n");
}
};
void main()
{
A a;
a.f();
mod2();
}
--- mod2.cpp ---
#include <stdio.h>
class A
{
public:
void f()
{
printf("mod2:A:f\n");
}
};
void mod2()
{
A a;
a.f();
}
---
Notice the local class A which inlines its functions. When running
this, I get:
mod1:A:f
mod1:A:f
instead of my expected:
mod1:A:f
mod2:A:f
The mod2.cpp's A:f() function is ignored and mod1.cpp:A::f() is called
instead!? Anybody have an explanation?
I tried this on MSVC6, MSVC7.1 and g++4.0; all exhibit the same
behavior.
Thanks,
Ruud