either up+cast is no such thing that you need to define and provide, or its a c++20 thing I haven't checked out and you need to enable c++20 in your compiler flags so it uses the new standard, or something of this nature. the compiler does not understand up_cast.
If i modified my code as below, it still gives compile errors:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
class XXX {
public:
int memberFunc();
};
class YYY : public XXX {
int memberFunc();
};
int main()
{
XXX * bptr = new YYY ;
YYY * dptr;
dptr = dynamic_cast<YYY*>(bptr);
}
Output:
15:35: error: cannot dynamic_cast ‘bptr’ (of type ‘class XXX*’) to type ‘class YYY*’ (source type is not polymorphic)