+ Start a Discussion
Hetal ShethHetal Sheth 

Need help in access inner class in apex


public class A{
  public class B {
  }
  public class C {
       public A.B show(){}
  }
}

------------
Look above exampe. I have one inner class C.I need to create instance of that class.
Can any one help me to create instance of class C and call method show of class C.

 
Mrunali GaonkarMrunali Gaonkar
Hi Hetal,

u can create instance for above as follows:
A.C obj = new A.C();
n using obj u can call the method.

Thanx and Regards,
Mrunali Gaonkar
Hetal ShethHetal Sheth
Thanx Mrunali,
But my classes are not static.
If my classes are static than I can call by above way.
Chaitanya Gupta KoradaChaitanya Gupta Korada
public class Maain_Class{
    public class Sub_Class{
    }
    public class Sub_Inner_Class{
        Maain_Class.Sub_Class class_ins = new Maain_Class.Sub_Class();
        public Maain_Class.Sub_Class show_method(){
            return class_ins;
        }
    }
}

hope it helps... HAPPY SALESFORCE :) :)
VempallyVempally
Hi folks,

WE CANNOT CREATE MULTIPLE INNER CALSSES...

FOLLOW THE LINK..

https://www.salesforce.com/us/developer/docs/apexcode/Content/apex_classes_defining.htm