Activity Forums Salesforce® Discussions What is abstract class ?

  • shariq

    Member
    September 22, 2018 at 11:20 am

    Abstract classes will be classes that contain at least one dynamic strategies. A conceptual technique is a strategy that is pronounced however contains no usage. Unique classes may not be instantiated, and expect subclasses to give usage to the theoretical techniques

  • Parul

    Member
    September 22, 2018 at 12:36 pm

    abstract classes can contain methods that don't require an override and methods that do require an override,  since it can contain methods that do require and override it must be extended to be constructed.  useful if you want to share code among several closely related classes that impliment a common interface

    eg:
    public abstract class abscl {
    public void m1(){ // Defined and Implemented
    System.debug(' I am in abscl: m1');
    }
    Public void m2(){ // Defined not implemented
    }
    public abstract void m3(); // Declared: Not Defined and Not Implemented this should be declared abtract method not implemented body method.
    }

    child class
    public class abschd extends abscl{
    public override void m3(){         // the abstract method should be declared in child class using override but object is created in child class only.

    System.debug('I am in absch: m3 ');
    }
    }

     

    Thanks

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos