Inherited sharing to secure Apex Code

Inherited sharing keyword to define apex class as Inheritedsharing is available with the Salesforce winter’19 release in both Salesforce classing and lighting versions.

– If the class is declared as inheritedsharing, it runs in the sharing mode of the class that called it.
– The keyword ‘inheritedsharing’ is used to define an Apex class as Inheritedsharing class.
– If a class declared as inheritedsharing, it runs as with sharing by default.
– A class defined as Inheritedsharing will only run in without sharing mode when it specifically called from an already established without sharing context.

To see an example and to know more about this refer URL: https://releasenotes.docs.salesforce.com/en-us/winter19/release-notes/rn_apex_inherited_sharing.htm