Mam taki prosty fragment kodu:
```cpp
struct base {
virtual void what() { cout<<"base\n"; }
};
struct derived_1: base {
void what() { cout<<"derived_1\n"; }
};
struct derived_2: base {
void what() { cout<<"derived_2\n"; }
};
struct generator {
generator() { srand(static_cast<unsigned>(time(0))); }
base* operator()() {
int i=rand()%2;
return i ? new derived_1 : new derived_2;
}
};
Chodzi o obiekt funkcyjny generator - uzywany do wypelnienia wektora wskaznikow ""base*" - kompilacja wywala blad "no conversion from "derived_2*" to "derived_1*". O co chodzi? Jaka konwersja?
Środowisko - Visual Studio .NET 2003