You need to sign in to do that
Don't have an account?
Sahil Sharma 36
Hi, Why are we able to refer 'Sobject' list to 'Account' list.
List<Account> accList = new List<Account>();
accList.add(new Account(name = 'ss'));
List<SObject> sObjectList = accList;
accList = sObjectList;
or
List<Account> aList = new List<SObject>();
accList.add(new Account(name = 'ss'));
List<SObject> sObjectList = accList;
accList = sObjectList;
or
List<Account> aList = new List<SObject>();
- Salesforce Object Search Language (SOSL) is a Salesforce search language that is used to perform text searches in records.
- This is an example of an SOSL query that searches for accounts and contacts that have any fields with the word 'SFDC'.
-
- https://trailhead.salesforce.com/en/modules/apex_database/units/apex_database_sosl
Hope it will be helpful.Please refer the below link for reference from Trailhead.
Thanks
Rahul
1) https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_sobject.htm
sObject methods are all instance methods, that is, they are called by and operate on a particular instance of an sObject, such as an account or contact.
sObject means, it can be of any persisted SFDC objects type.
For ex: Vehicle is generic type and Car, Motor Bike all are concrete types of Vehicle.
In SFDC,sObject is generic and Account, Opportunity, CustomObject__c are its concrete type.
Generic sObject abstracts the actual representation of any object assigned to it. sObject is the name of the generic abstract type that can be used to represent any persisted object type.
Let me know if you still have any doubts.