In Salesforce, a wrapper class is a custom data type that combines multiple objects or data types into a single unit. It is often used to display data from multiple objects or data types in a single Visualforce page or Lightning component.

For example, let’s say you want to display a list of accounts and their related contacts in a Visualforce page. You could create a wrapper class that combines the data from the Account and Contact objects into a single unit, and then use that wrapper class to display the data in the page.

To create a wrapper class, you will need to define a class with the desired data types and variables. For example:

public class AccountWrapper {
  public Account account {get; set;}
  public Contact contact {get; set;}
  public Boolean selected {get; set;}
}

In this example, the wrapper class contains variables for an Account object, a Contact object, and a Boolean value for a “selected” field. You can then create a list of these wrapper objects and use it to display the data in a Visualforce page or Lightning component.

Wrapper classes are particularly useful when working with Visualforce pages or Lightning components, as they allow you to display data from multiple objects or data types in a single page or component. They can also be used in Apex controller methods to manipulate data from multiple objects or data types in a single action.

Overall, wrapper classes are a useful tool for working with data in Salesforce, and can be used to combine and display data from multiple objects or data types in a single unit.