get object before create it , is it possible
<p>Is it possible to get the object before create the object itself?</p>

<p>like this</p>

<pre><code>template &lt;class T&gt;
class Event {
protected:
    T*Obj ; 
public:
    void onclick() { Obj-&gt;getobject()-&gt;dosomthing ; }  // i need help how to get the object
};

class myclass : public Event&lt;myclass&gt; {
public:
    Event&lt;myclass&gt;* getobject() {return Obj;}
    myclass* createobject() ; 
};
</code></pre>

<p>I try a few codes and ideas but it always fails and I get nothing ( null pointer )</p>

<p>I try pointer to member, and pointer to function but it fails too!
I don't now if I explain what I want exactly.</p>

<p>Any help?</p>

<p>Here is the full code </p>

<pre><code>template &lt;class T&gt;
class GUI_Event
{
private:
    static bool _Donothing (const EventArgs &amp;Args) {return false ; }
    T*Obj ;

protected:

    /*for window only*/

    bool ( *CloseClicked )                     (const EventArgs &amp;Args) ;
    /* event fired on left mouse click*/
    bool ( *_L_Mouse_Click_DoFunction )        (const EventArgs &amp;Args) ;
    /* event fired on right mouse click*/
    bool ( *_R_Mouse_Click_DoFunction )        (const EventArgs &amp;Args) ; 
    /*event  fired on middle mouse click*/
    bool ( *_M_Mouse_Click_DoFunction )        (const EventArgs &amp;Args) ; 



public:



    /*set up fired function on left mouse click event*/

    const void Set_L_Mouse_Click_DoFunction( bool (*Function)(const EventArgs &amp;Args))  {this-&gt;_L_Mouse_Click_DoFunction = NULL ; 
                                                                                           this-&gt;_L_Mouse_Click_DoFunction = Function ;
                                            Obj-&gt;Get_FrameWindowPtr ()-&gt;subscribeEvent ( FrameWindow::EventMouseClick , CEGUI::Event::Subscriber ( &amp;_L_Mouse_Click_DoFunction ));} 

    /*set up fired function on right mouse event click */

};

class GUI_Window : public GUI_Event&lt;GUI_Window&gt;
{


private:


    static void SetID() ;
    /*
    Identifie Number For The Window
    */
    static int ID ; 

    /*
    /the Identifir Number for current window
    */
        int Wnd_ID ; 
        //Frame WIndow 
        CEGUI::FrameWindow        *_Frame_Window ;





        /* Window Name == value by the user */
        CEGUI::String             *_Window_Name ;


        /*window type == for now is inluded ( XML FIle (without extension)/FrameWindow )*/
        CEGUI::String             *_Window_Type;



        /* XML File that include style of the GUI   */
        String                    *_File_Name; 






public:

/*  create a Window */
        explicit GUI_Window ( CL_HUD const*Hud , String const&amp;Window_Name );
        /*  create a Window */
        explicit GUI_Window ( const CL_HUD &amp;Hud , String const&amp;Window_Name );


    /*
    return current framewindow As Pointer 
    */
    FrameWindow              *const Get_FrameWindowPtr ()const                      { return _Frame_Window ; }
        /*
    return current framewindow 
    */
    const FrameWindow        &amp;Get_FrameWindow ()const                               { return *_Frame_Window ; }





    /*return current window type*/
    const String            &amp;Get_WindowType()  const                               { return *_Window_Type ;}
    /*return current window type As Pointer */
    String                  *const Get_WindowTypePtr()  const                      { return _Window_Type ;}



    /*return current window name As Pointer  */
    String                   *const Get_WindowNamePtr()  const                     { return _Window_Name ;}
    /*return current window name*/
    const String             &amp;Get_WindowName()  const                              { return *_Window_Name ;}


    /* return XML File Name Scheme */
    const String             &amp;Get_File_Name()  const                               { return *_File_Name ;}
    /* return XML File Name Scheme As Pointer */
    String                   *const Get_File_NamePtr()  const                      { return _File_Name ;}


    void SetText(String text )                        { Get_FrameWindowPtr ()-&gt;setText ( text ); *_Window_Name = text ; }
    int Get_ID ()                                                                  { return Wnd_ID ; }
    ~GUI_Window();


};
</code></pre>

<p>The problem is that I get a null pointer in this following line</p>

<pre><code>Set_L_Mouse_Click_DoFunction
</code></pre>
