Original Post
Hi! I simplified my problem a bit, so it is easier to understand. I have a simple base class with a certain virtual method. The constructor of that class calls the method and that's all. Now I derive another class from that base class which overrides the virtual method. What I expected when initializing the derived class was to get the output from the derived method. In fact the method from the base class was called. I think this behaviour is quite astonishing and therefore I just wanted to know why that happens and how I can fix this. A small example:
#include <stdio.h>
struct ClassDay
{
virtual void say();
ClassDay();
};
struct ClassMorning : ClassDay
{
virtual void say();
};
void ClassMorning::say(){ printf("Good morning!"); }
void ClassDay::say(){ printf("Hello!"); }
ClassDay::ClassDay(){ say(); }
void main()
{
ClassMorning test;
getchar();
} I hope you can help :)