Probably a duplicate, but not an easy one to search for...
Given a header like:
namespace ns1
{
class MyClass
{
void method();
};
}
I've see method()
defined in several ways in the .cpp file:
Version 1:
namespace ns1
{
void MyClass::method()
{
...
}
}
Version 2:
using namespace ns1;
void MyClass::method()
{
...
}
Version 3:
void ns1::MyClass::method()
{
...
}
Is there a 'right' way to do it? Are any of these 'wrong' in that they don't all mean the same thing?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…