This is bad for many reasons:
This is infinite recursion. It will make your program collapse.
If X() calls X(), then X() will call X() which calls X() which calls X(), etc, etc, etc. forever and ever until you run out of stack space and the program dies.
But even if that worked, X() returns a temporary object. wsk may point to it, but as soon as the next line of code runs, the temporary object is destroyed and wsk becomes a bad pointer.
Why would you need to do this anyway?
|
std::vector<Y(*wsk) > wektor;
|
You're trying to mix a constructor with a type definition. This doesn't work. You have to make this as
std::vector<Y>
, then when you add Ys to the vector, you construct them appropriately.
Your classes are somewhat of a giant mess. You should really rethink this design.
What exactly are you trying to accomplish, here?