in c++ what is the difference between using a namespace and a class??
like:: in this example i added namespace
#include <iostream>
using namespace std;
namespace ns{
void print(){
cout<<"Hello, World!";
}
}
int main(){
ns::print();
return 0;
}
vs: and in this one i added a class
#include<iostream>
using namespace std;
class cs{
void print(){
cout<<"Hello World!";
}
}
int main(){
cs classOject;
classObject.print();
return 0;
}
but both got me the same result;;; that question made me keep thinking for a week
thanks for any replies guys and all repliers are much appreciated...