Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > namespaces and forward declarations

Reply
Thread Tools

namespaces and forward declarations

 
 
matthew polder
Guest
Posts: n/a
 
      07-24-2003

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


 
Reply With Quote
 
 
 
 
John Harrison
Guest
Posts: n/a
 
      07-24-2003

"matthew polder" <(E-Mail Removed)> wrote in message
news:bfovtv$flh$(E-Mail Removed)...
>
> 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


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Forward declarations and namespaces Victor Bazarov C++ 5 03-23-2009 03:24 PM
Namespaces and declarations kk565 C++ 1 01-27-2008 08:57 AM
Forward declarations and inlining jimmy C++ 3 05-17-2005 05:34 AM
forward declarations and namespaces? Steven T. Hatton C++ 6 05-05-2004 01:26 PM
Forward declarations and namespaces whithers C++ 4 01-16-2004 07:12 AM



Advertisments