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
Max PowerMax Power 

How do I enable inheritance?

I'm writing an Apex application and I would like to use inheritance.  I read in the language reference that this is not enabled for all instances, and indeed when I tried to declare a virtual class in my instance, I got an error message from eclipse that said that virtual classes are not allowed in my instance.  My question is: How do I enable this feature?
 
As a follow up, if I use inheritance and then publish my application to the AppExchange, will anyone that uses this application need to enable inheritance on their instance as well, or is this required only on the development instance?
 
Thanks in advance,
Max
ckempckemp
Max,

Did you ever find out an answer to this question?  I'd like to know the same as I need to use abstract functions (a pretty basic OO concept) on an app that I want to publish on AppExchange.

Thanks!
Max PowerMax Power
While I was never able to find anything in any of their documentation, I was able to get a response from a Salesforce representative:
 


Log a case here: http://www.appexchange.com/support

Under technical, there is a request type for feature activation. Support has the perms to enable this. Be sure to provide your org id.



I submitted a request for this feature last week and still have not heard anything back.  They claim 2 business days, but it has been longer than that.  You can see if this works for you.
 
I'm not sure if it helps you, but I was able to use abstract classes in my organizations, but not virtual classes/methods.  I'm not sure why they have this restriction in place, but I was able to work around it using an abstract class with abstract methods.
 
Good luck!
 
-Max
ckempckemp

Max Power wrote:

I'm not sure if it helps you, but I was able to use abstract classes in my organizations, but not virtual classes/methods.  I'm not sure why they have this restriction in place, but I was able to work around it using an abstract class with abstract methods.



That is very good to know, but I need the ability to override inherited methods and apparently the only way to do that is by making the overidden function virtual (since Apex doesn't assume virtual like Java.)  It's unfortunate because when I put my app on AppExchange I don't want to have clients that install it have to jump through the same hoops.  Looks like I'll have to resort to bad OO and make hooks in my Class that will be used instead of proper inheritance.

Please vote for my virtual petition to have these turned on by default (link in my signature). :-)  Thanks!
ckempckemp