Activity Forums Salesforce® Discussions What is the use of this keyword in Salesforce Apex?

  • chanchal kumar

    Member
    August 29, 2018 at 12:19 pm

    Hello Anurag

    This keyword defines a method/variable that is only initialized once, and is associated with an (outer) class, and initialization code.

    Example:
    public class Foo {
    public Foo(String s) { /* … */}
    public foo() {
    this(‘memes repeat’); }
    }

  • madhulika shah

    Member
    August 29, 2018 at 12:19 pm

    Hi Anurag,

    This keyword represents the current instance of a class, in constructor chaining.

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos