function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
bhupal reddy 7bhupal reddy 7 

what will happen if one apex class is called in another apex class?

I have two classes  ClassA and ClassB with WITH SHARING and WITHOUT SHARING keywords respectively. 

Now what will happen if I call ClassB into ClassA?
On which context they finally Run Finally?
 
SwethaSwetha (Salesforce Developers) 
HI Bhupal,
From https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_keywords_sharing.htm , Inner classes do not inherit the sharing setting from their container class. Otherwise, the sharing setting applies to all code contained in the class, including initialization code, constructors, and methods.

See related post: https://salesforce.stackexchange.com/questions/25817/innerclasses-marked-as-without-sharing-outerclass-is-with-sharing

https://salesforce.stackexchange.com/questions/231495/sharing-rules-and-inner-classes

https://developer.salesforce.com/forums/?id=906F0000000Ba9DIAS

If this information helps, please mark the answer as best. Thank you