Hi,
In addition to the previous answers. If you have for instance a class with a
static function (i.e. independent of a specific object (the 'this' pointer
is not passed)) you could use ::
class example
{
public:
static void StaticFunction()
{
}
void ObjectFunction()
{
}
};
.......
#include <memory>
using namespace std;
....
example::StaticFunction(); // this is ok, no object (this pointer) available
or needed)
auto_ptr<exampleEx( new example);
Ex->ObjectFunction(); // this too, we need a real object here, the this
pointer is needed (invisible, pushed last on the stack)
Regards, Ron AF Greve
http://www.InformationSuperHighway.eu
"Rolf Magnus" <ra******@t-online.dewrote in message
news:f0*************@news.t-online.com...
Johs wrote:
>When I declare a string in C++ I type:
std::string mystring = "sdfsdf";
afterwards I can access string methods like:
mystring.
but why is there both :: and . operators and what are the difference?
The former is used for classes and namespaces, the latter for objects.