2

What is the equivalent of this when calling a static method in Apex, besides the class name?

For instance

class A {
    public static void foo(){
        this.bar(); //what to use here, instead of this.bar() or A.bar()
    }

    private static void bar(){
        //some stuff
    }
}
  • this doesn't work in static methods – Pramod Kumar Jan 25 '13 at 11:37
  • 3
    I know, hence the question.... – rael_kid Jan 25 '13 at 12:36
6

You would simply omit the 'this' and call it as follows:

bar();
  • no problem...sometimes you can't see the wood for the trees :) – Phil Hawthorn Jan 25 '13 at 10:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.