currently I have a class function:

class MyClass{
    static int E(int A,int B, int C){
        //function code
    }
};

//and I call it like this :
MyClass::E(1,2,3);

//what I would like to do is call it in this way:
E(1,2,3);

//my current macro definition is this
#define E(a,b,c) Myclass::E((a),(b),(c))

how do I correct my macro definition to generate the corect code?

This works, but I wouldn't recommend it! :
#define E MyClass::E
Which would cause the pre-processor to expand any instance of E in the cpp file to MyClass::E.
So you could use:
E(1,2,3) in your code and the pre-processor will expand the macro to MyClass::E(1,2,3)

But the downside is, if you have any instances where the function is called like this:
MyClass::E(1,2,3)
The pre-processor will expand the line to:
MyClass::MyClass::E(1,2,3)

Personally I'd stick to using MyClass::E to call your function, but that's just me! I think using a macro for this is a bad idea!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.