Solved

Header Question (namespaces)

Posted on 2003-10-27
1
231 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Cross compile release version of c++ program for linux 2 139
C++ to C# code conversion issue 4 121
computer science syllabus 3 103
Least Squares Curve Fitting 4 117
Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
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 be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

730 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