see these class:

class test
{
   public:
       void Created(){};
       test()
       {
           Created();
       }
};

now we can create objects from it. ok.
but can i overloading the scope-resolution ('::') for the object accept and change the Created() function?

for change the functions(with diferente objects) outside of functions\class and others.

(in my case) the problem of class direved from other class is that i must re-declare the functions

Edited 3 Years Ago by cambalinho

You'd have to redeclare the function even if you could overload ::, so what's the problem?

class test
{
   public:
       virtual void Created() {cout << "Hello from test class\n";}
       test()
       {
           Created();
       }
};

class Child : public text
{
public:

   virtual void Created() {cout << "Hello from Child\n";}
 };

 int main()
 {
     Child c;
     c.Created();  // call Created in Child class
     c.test::Created(); // call Created in test class
 }

some day ago i read something, so please correct me.
i understand that i can't use a varname outside the functions\class's with '::' operator, but seems that i can use with static functions, can you explain please?

i understand that i can't use a varname outside the functions\class's with '::' operator

Make the variable static and you can use it outside the class with :: opertor.

class MyClass
{
public:
   static int x;
 };

int MyClass::x = 0; // static variables must also be declared like globals

int main()
{
    MyClass::x = 1;
}

Functions are coded as normal.

class MyClass
{
public:
   static int x;
   static int foo();
 };

int MyClass::x = 0; // static variables must also be declared like globals
int MyClass::fo()
{
    return x;
}

int main()
{
    MyClass::x = 1;
}

Edited 3 Years Ago by Ancient Dragon

This question has already been answered. Start a new discussion instead.