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
Darshit Pathak 10Darshit Pathak 10 

Why multiple classes cannot be inherited apex?

As java provides multiple inheritance, so that class can inherit properties and methods of 2 different parent classes. But apex doesn't support that. Can anyone tell the conecpt/reason behind this?
VinayVinay (Salesforce Developers) 
Hi Darshit,

Apex syntax is mostly based on Java and it does not allow multiple inheritance.  Salesforce allows multiple interface implementation and to inherit any class it must be defined with keyword Virtual.

Something like below:
Virtual class A
Virtual class B extends A
Class C extends B

Hope above information was helpful.

Please mark as Best Answer so that it can help others in the future.

Thanks,