So I have a class (B1) and an inner class (B1 again) in another class (A1).
public class A1 {
public A1() { //constructor
B1 obj = new B1();
}
public class B1 {
public B1() { //constructor
System.debug('inner class');
}
}
}
public class B1 {
public B1() { //constructor
System.debug('outer class');
}
}
When I execute new A();
in anonymous window, I get inner class printed, but I need the instance of outer B1 class. One way to create the object of outer class is dynamic way with Type.forname
, though I was wondering if there is any way to create the object in static manner. Like if we have a custom class Database, we can use System.Database
for salesforce native class because of System namespace. Do we have something here?