function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Lukesh KarmoreLukesh Karmore 

can any one explain me

see below some code  of wrapper class
 public void ProcessSelected(){
selectedAccounts=new list<account>();
for(wrapaccount wrapobj:wrapaccountlist){ if(wrapobj.isSelected==true){
selectedAccounts.add(wrapobj.accn);
}
}

public class wrapaccount{
public account accn{get;set;}
public boolean isSelected{get;set;}
public wrapaccount(account a){
accn=a;
isselected=false;
}
}
}
it is not full code , so my question is 
selectedAccounts.add(wrapobj.accn);
in above codeLine  why we did this wrapobj.accn
can any one  answer me .
Thank You
Akshay Dhiman 63Akshay Dhiman 63
Hi Lukesh,
I have gone through your query. So, when we create a Wrapper class then we have to make its instance to access its variables. Like here you have created a wrapper class and variables in it. So to access these variables we create an instance(wrapob) of class(wrapaccount) so you can access variables using this.

https://www.pebibits.com/wrapper-classes-in-apex/

Hope this explanation will resolve your query. Mark it as the best answer if you find it helpful.
Thanks
Akshay