I have:

public virtual classA{
    public classA(ApexPages.StandardController controller){}

 public virtual classA_Test extends classA{

 Error in classA_Test: Method does not exist or incorrect signature: [classA].<Constructor>()

 IDE: Force.com

What is the problem here?


1 Answer 1


When you define a constructor that takes parameters, the default 0-argument constructor is lost.

When you instantiate classA_Test, it implicitly calls the super() constructor, which no longer exists. If you want to avoid this behavior, you need to call a different constructor that is defined, e.g.:

virtual class Vehicle
    Vehicle(ApexPages.StandardController controller) { /*do stuff*/ }
class MagicCarpet extends Vehicle
    MagicCarpet() { super(new ApexPages.StandardController()); }

Side note, you cannot inherit constructors. See: Inheriting non-implicit constructors on Apex classes.

  • RESULT: Constructor not defined: [ApexPages.StandardController].<Constructor>() in the MagicCarpet class Nov 25, 2015 at 18:16
  • Yeah I mean it doesn't actually make sense to set it up the way you have it. Why are you creating an extension when you don't have a controller? What are you trying to accomplish?
    – Adrian Larson
    Nov 25, 2015 at 18:48

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.