Solved

Header Question (namespaces)

Posted on 2003-10-27
1
227 Views
Last Modified: 2010-04-02
Two part quesiton.

1.  Are namespaces only good for files?  If I declare using namespace x in a .h file, then I must also make that declaration in the .cpp file that includes that.  Is this correct?

2.  I am trying to do some xml stuff, and I declare using namespace MSXML2, but when I try to create a IXMLDOMDoucmentPtr I get an error because it is ambiguous.  why?
0
Comment
Question by:jjacksn
1 Comment
 
LVL 17

Accepted Solution

by:
rstaveley earned 200 total points
ID: 9631053
Ref 1: If you put using namespace into the .h, it is equivalent to putting it ito the .cpp, but it is bad practice because you are forcing anything that uses the .h to use the namespace.

Ref 2: See http://support.microsoft.com/default.aspx?scid=kb;en-us;316317
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now