Hi,

In the below example, inside the implementation of the static function f1 is there a way to determine whether A::f1() or B::f1() invoked f1 ?

Code:
class A
{
    public:
        static A* f1();
};

A* A :: f1()
{
    // Is there a way to identify if A :: f1() or B :: f1() has invoked me ?
    return(new A); //just a dummy return statement for the sake of the example

}

class B : public A
{};


int main()
{
    A* p1 = A :: f1();
    A* p2 = B :: f1();

    delete p1;
    delete p2;

    return(0);
}
The reason I ask is because I was wondering if f1 function could create an instance of A or B depending on weather A::f1() or B::f1() is called