problem in including files

I am facing a strange problem I m including a header file which in turn include all the required file in propersequence now as per normall situation a class defined in a file already included must be knwon to the later file but it is not happening i need to include all those files explicitly in later file to make the class known to that file and I m using gcc 4.1.2 for the compilation so if anybody hav anyidea abt this plz let me know.

Thanks in advance !!!

Shailesh Bansal

Comments

  • : I am facing a strange problem I m including a header file which in
    : turn include all the required file in propersequence now as per
    : normall situation a class defined in a file already included must be
    : knwon to the later file but it is not happening i need to include
    : all those files explicitly in later file to make the class known to
    : that file and I m using gcc 4.1.2 for the compilation so if anybody
    : hav anyidea abt this plz let me know.
    :
    : Thanks in advance !!!
    :
    : Shailesh Bansal


    If Class B needs to reference a pointer to Class A before Class A has been declared, then you can pre-declare Class A like this
    [code]
    class A;

    class B
    {

    Class* pA; // declare a pointer of type class A

    };
    [/code]

    Note that you must use pointer as in my example above. And clsass B can not reference any of class A's methods or other objects.


    =============================================
    never lie -- the government doesn't like the competition. (Author unknown)
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion