-1

So I just started as an intern and the code that I'm supposed to be working on is scattered within like 10 different directories and 100 files and who knows how many namespaces. I've never worked with this before, and I'm really confused how they are all being linked together.

I keep seeing these sorts of statements one after the other, ex:

using something10::something2::something6;
using isThisANamespace::iHaveNoIdeaIfThisIsAClassNameOrWhat::something599;
using randomName::otherRandomName::randomName99999;
using something4::something3::something8766678788787987987698;

Whenever I try to google what using does, I only find results with using namespace. Is using now just a shorter way of using namespace? Some of the things they are using appear to be folder names and file names though. My company mentor doesn't know c++ so he can't help me alas.

Also, if these are all namespaces, then wouldn't using so many of them conflict? Can you call namespace::classname::function? And when you do this do you still have to include the filename for that class?

Please help me learn how to call a function buried in another directory that is also in 4 namespaces. I'm very lost.

Paula
  • 35
  • 7
  • "and who knows how many namespaces" - always a very bad sign; the architecture astronauts have been busy. And BTW, filenames and namespaces have no relationship with each other in C++. –  Jun 07 '17 at 21:02
  • 1
    You've been hired as an intern and they couldn't find you a mentor that's capable of mentoring you? That's not a good sign. You should get one of [these](https://stackoverflow.com/questions/388242/the-definitive-c-book-guide-and-list). You will find "using" in the index. – molbdnilo Jun 07 '17 at 21:06
  • [Reminds me of something a little bit off topic](https://www.youtube.com/watch?v=0oGMbAIcXCQ) – user4581301 Jun 07 '17 at 21:36

3 Answers3

1

This is a using-declaration. It introduces a single name from another namespace into the current scope so that it can be used without qualification. It's not the same as a using-directive, which begins with using namespace.

LW001
  • 2,452
  • 6
  • 27
  • 36
Brian Bi
  • 111,498
  • 10
  • 176
  • 312
0

check below link, hopefully it will help you on what you are looking for https://www.tutorialspoint.com/cplusplus/cpp_namespaces.htm

Deepak Bhise
  • 161
  • 8
-1

If there really just random naming, than it's very-very bad. BUT I hope it's just yours personally vision, as beginner in C++, and in reality there is a good code, but kinda complex.

I don't know yours background, what languages you know, so I would say that namespaces are kinda boxes. They can build very good, hierarchically structured, modules\subsystems. I suggest you to not panic, take paper and try to wrote out all namespaces, their relations, what is in them (classes, structures, maybe functions) and your own understanding them purposes.

P. S. sorry for bad English. This topic very close for me, but my writing skills in English are not very good for a free conversation about this. I hope moderators will fix typos.

Green_Wizard
  • 795
  • 5
  • 11