Skip to main content
Hi,

I was trying to call an method of class 1 in class 2. but i am getting this error while saving class 2.

Error: Compile Error: Constructor is not visible: <IPgap>(constructor)

Ex:

Class 1:

public class IPgap 

{

   public Opportunity  opp{get; set;}

   public IPgap (ApexPages.StandardController controller)

      {

         //Some logic

      }

   private void Info(){

        intrest = new List<SelectOption>();

     }

}

Class 2:

global without sharing class ipHelper {

    //variable declarations

 public void method1() 

    {

        IPgap ipreq = new IPgap();

        string returnValue = ipreq.Info();

    }

}

Anyone can help me.

Thanks

Vivek
4 answers
  1. Oct 28, 2015, 9:45 AM
    try this

     

    global without sharing class ipHelper {

    //variable declarations

    public void method1()

    {

    Opportunity opp = new Opportunity();

    ApexPages.StandardController sc = new ApexPages.StandardController(opp);

    IPgap ipreq = new IPgap(sc);

    string returnValue = ipreq.Info();

    }

    }

    Thanks,

    Alex
0/9000