I have less experience on Java Programming and hence posting this for all those who are familiar with basics of apex but unfamiliar with OOPS concepts like inhertience and polymorphism of Java
Problem description:I knew that the virtual keyword is used to extend a class and thanks to great documentation from salesforce.(http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_classes_example.htm) But my problem is no where in document it is mentioned how to proceed if in my parent class there is a parameterized constructor .
Example:
global virtual class sobjectWrapper{ sobject sobjectDetails; String RefreshFlag=''; public sobjectWrapper(sobject r){ sobjectDetails=r; } }
As seen in the above code there is a parametrised constructor.
First i attempted to write the extended the class as shown below
global class extutilility extends sobjectWrapper{ sobject sobjectDetails; String RefreshFlag=''; private string abc; extutilility(sobject r){ sobjectDetails=r } }
As expected error ...compile time saying " Method does not exist or incorrect signature: [sobjectWrapper].
Disappointed on my java skills .Had to google little to find what i am i missing.
Here is how it needs to be written
global class extutilility extends sobjectWrapper{ sobject sobjectDetails; String RefreshFlag=''; private string abc; extutilility(sobject r){ super(r); } }
Use of Super Keyword is what i did not now and here is the exact situation i need badly.
Hope this helps lot of apex developers not familiar with Java completely
Nice Article, just to add onemore thing : we cannot use super keyword, other than virtual or abstract classes
ReplyDeleteThanks for Sharing a post. It was nice post and very effective. To know about Business or want to buy home plz visit atleast once...
ReplyDeletehouse and lot for sale in imus cavite
condo for sale philippines
house and lot for sale in bacoor cavite
house and lot for sale
RFO House and Lot
house and lot for sale in dasmarinas cavite
condominium for sale philippines
house and lot for sale in imus cavite
condo for sale philippines
house and lot for sale in sta rosa laguna
house and lot for sale in cabuyao laguna