cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
General C++ Programming
Forward reference to class in external n
Forward reference to class in external namespace
Aug 25, 2012 at 2:35am UTC
Castalia
(1)
When declaring a forward reference to a class in external namespaces I've found that the following syntax works as desired:
1
2
3
4
namespace
A {
namespace
B {
class
C; }}
This is a bit awkward, but the syntax -
class
A::B::C;
- is rejected.
Is there an acceptable, and succinct, alternative syntax for this case?
Aug 25, 2012 at 7:05am UTC
JLBorges
(13770)
> Is there an acceptable, and succinct, alternative syntax for this case?
AFAIK, no.
Last edited on
Aug 25, 2012 at 7:07am UTC
Aug 25, 2012 at 10:09am UTC
vlad from moscow
(6539)
A translation unit has to know how the names A and B were declared. That is it has to know what entities are denoted by A and B.
Topic archived. No new replies allowed.