sObject is a generic representation of any object in Salesforce. For eg: Account, Contact, MyCustomObject__c, Test__c etc are sObjects.
Infact we can consider sObject to be the abstract parent class of any object in salesforce. Account, Contact, MyCustomObject__c are the child objects the sObject.
Hence, we the following lines of code are true.
Account a = new Account();
sObject s = new Account();
sObject s1= new Contact();
Here a instance of account or contact can be stored in sObject as it is the parent.
sObject is a generic representation of any object in Salesforce. For eg: Account, Contact, MyCustomObject__c, Test__c etc are sObjects.
Infact we can consider sObject to be the abstract parent class of any object in salesforce. Account, Contact, MyCustomObject__c are the child objects the sObject.
Hence, we the following lines of code are true.
Account a = new Account();
sObject s = new Account();
sObject s1= new Contact();
Here a instance of account or contact can be stored in sObject as it is the parent.
Hope this helps.
Regards,
Satish Kumar
Hi,
sObjects includes all the Standard and Custom objects in your organization.
you can instantiate sObject with any of your object in your org.
sObject sobj = new Account();
sObject sobj = new Custom__c();
Hi,
The term sObject refers to any object that can be stored in the Force.com platform database.
The new operator still requires a concrete sObject type, so all instances are specific sObjects. For example:
sObject s = new Account();
You can also use casting between the generic sObject type and the specific sObject type. For example:
Because sObjects work like objects, you can also have the following:
DML operations work on variables declared as the generic sObject data type as well as with regular sObjects.
For refernce
http://www.salesforce.com/us/developer/docs/apexcode/Content/langCon_apex_SObjects.htm
If this post is helpful please throw Kudos.If this post solves your problem kindly mark it as solution.
Thanks