Activity › Forums › Salesforce® Discussions › What are wrapper classes in Salesforce?
-
What are wrapper classes in Salesforce?
Posted by shariq on July 26, 2017 at 11:29 AMExplain Wrapper class with examples?
Parul replied 7 years, 7 months ago 3 Members · 2 Replies -
2 Replies
-
Hi Shariq
A wrapper or container class is a class, a data structure, or an abstract data type which contains different objects or collection of objects as its members.
A wrapper class is a custom object defined by programmer wherein he defines the wrapper class properties. Consider a custom object in salesforce, what do you have in it? fields right? different fields of different data types. Similarly wrapper class is a custom class which has different data types or properties as per requirement. We can wrap different objects types or any other types in a wrapper class.In the Visualforce most important use case is to display a table of records with a check box and then process only the records that are selected.
In the example below, we are displaying list of accounts with checkbox. End user can select account and then click on Show Selected accounts button. Then selected account will be displayed in table.
- [adinserter block='9']
-
A wrapper class is a custom object defined by programmer wherein he defines the wrapper class properties. Consider a custom object in salesforce, what do you have in it? fields right? different fields of different data types. Similarly wrapper class is a custom class which has different data types or properties as per requirement. We can wrap different objects types or any other types in a wrapper class.
Thanks
Log In to reply.