To clarify I was wondering how to return the type of a class within the class definition.
Even though an answer was given I ended up reverting back to using a virtual function, which kind of made more sense in the long run.
Sorry for the confusion.
You could write A as the return type? Classes define user-defined types, meaning they can be used as return types. Sorry, if I misinterpreted your question though, and if there is an error, please point it out. Anyways, here is the code below:
class A
{
//....
public:
A someFunction();
//.....
}
//implementation:
A A::someFunction()
{
//Code....
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With