namespaces and forward declarations

Discussion in 'C++' started by matthew polder, Jul 24, 2003.

  1. Hi,

    I have two libraries that used different namespaces, call them "fruit" and
    "vegetable." In one of the class definitions of fruit, I have the following.

    class corn; //This doesn't work.

    namespace fruit
    {
    class Apple
    {
    Apple( const vegetable::corn& )
    {}
    };

    }

    How do I do a forward declaration for something in a namespace?

    thanks,
    matthew
     
    matthew polder, Jul 24, 2003
    #1
    1. Advertising

  2. "matthew polder" <> wrote in message
    news:bfovtv$flh$...
    >
    > Hi,
    >
    > I have two libraries that used different namespaces, call them "fruit" and
    > "vegetable." In one of the class definitions of fruit, I have the

    following.
    >
    > class corn; //This doesn't work.
    >
    > namespace fruit
    > {
    > class Apple
    > {
    > Apple( const vegetable::corn& )
    > {}
    > };
    >
    > }
    >
    > How do I do a forward declaration for something in a namespace?
    >
    > thanks,
    > matthew
    >


    Have you tried?

    namespace vegetable
    {
    class corn;
    }

    john
     
    John Harrison, Jul 24, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. whithers
    Replies:
    4
    Views:
    386
    Sumit Rajan
    Jan 16, 2004
  2. Steven T. Hatton

    forward declarations and namespaces?

    Steven T. Hatton, Apr 27, 2004, in forum: C++
    Replies:
    6
    Views:
    3,273
    Dave Moore
    May 5, 2004
  3. jimmy
    Replies:
    3
    Views:
    404
    John Carson
    May 17, 2005
  4. John Ratliff
    Replies:
    2
    Views:
    338
    John Ratliff
    Aug 26, 2005
  5. Victor Bazarov

    Re: Forward declarations and namespaces

    Victor Bazarov, Mar 20, 2009, in forum: C++
    Replies:
    5
    Views:
    1,241
    Victor Bazarov
    Mar 23, 2009
Loading...

Share This Page