struct as a type for function in C++
<p>I am learning C++ and am trying to create a function with a return type of "my_message_t" that was defined in the class definition. However when I tried to compile it, compiler informed me that error: <strong>‘my_message_t’ does not name a type</strong></p>

<p>I have the following code (protocols.h and protocols.cpp)</p>

<pre><code>    namespace Protocols {
                class Messages {
                    public:

                        typedef struct _my_message_t {
                            //stuffs
                        } my_message_t;

                        typedef enum {
                                //stuffs 
                        } my_message_e;

                private:
                    my_message_t                            my_msg;
                    my_message_e                            msg_en; 

                public:
                    Messages();     
                    ~Messages();    

                    my_message_t create_message(const my_message__e); 

            };
        };
</code></pre>

<p>with the class definition is below:</p>

<pre><code>            namespace Protocols {

                    Messages::Messages(){
                        //stuff
                    };

                    Messages::~Messages(){
                        //stuffs
                    }

                    my_message_t Messages::create_message(my_message_e type){
                        my_message_t msg;

                        //do stuffs

                        return msg;
                    }
            }
</code></pre>

<p>Why I can not create a function with a type of <code>my_message_t</code> ? How do I fix that code above?</p>
