First actual post here.
I am fairly new to Apex Classes and I'm working on an existing project.
The previous developer has the following inside of an apex class:
private List<id> accountsMainList = new List<id>();
Boolean archiveSync = false;
public BDGAccSync(Boolean archiveSync) {
this.archiveSync = archiveSync;
}
public BDGAccSync(List<Account> accountsMainList) {
for (Account acc : accountsMainList) {
this.accountsMainList.add(acc.id);
}
}
My question is - Does the second instance override the first or does Salesforce support overloading like java, etc?
UPDATE: Thank you all for the quick answers 🙌 Overloading it is!
this.accountsMainList.addAll(accountsMainList);
and eliminate the for loop