What is Wrapper class?

Let me break down your question in to three parts.

1) What is Wrapper class?

Wrapper class is a class with primitive data types and objects as a class member variable. For example : 

public class WrapperExample{

      public Account acc;

      Public boolean isSelected;

     Public Integer someCount;


Reference link:



2) How to use?

You can use wrapper class as  noraml class in apex.

Eg: WrapperExample firstAccount = new WrapperExample();


3) When to use ?

You can go for wrapper class when you want to perform some operation in the records using other then object fileds in that case you can use it. There are more scenarios you want to think logically inorder ot use it .

Hope this is helpful for you if you want any deep dive let me know in comments.

No votes yet