Found 7401 Articles for C++

How will you compare namespaces in Python and C++?

Rajendra Dharmkar
Updated on 10-Feb-2020 10:43:10

356 Views

Namespaces in Python and C++ cannot really be compared. For example, in C++ −// a.h namespace ns {     struct A { .. };     struct B { .. }; }If we were to do this −#include "a.h" using ns::A;The point of that code is to be able to write A unqualified(ie, not having to write ns::A). Now, you might consider a python equivalent as −from a import ABut regardless of the using, the entire a.h header will still be included and compiled, so we would still be able to write ns::B, whereas in the Python version, a.B ... Read More

Advertisements