[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 180
  • Last Modified:

Calling the inehritor class

hi all

I have a main class named AccountsManager(). this calss call another class called Accounts(account_number,account_name) to create multiple accounts. what I need is a way to do certain actions (update) for all the Accounts created when a certain thing happened in one of these accounts. I hope I describe the it clearly.

0
ehmf
Asked:
ehmf
2 Solutions
 
ehmfAuthor Commented:
to make the things more clear. In each class Account, I have a function update_fields(). I want to call this function in all the accounts in the same time when a condition happened.
0
 
objectsCommented:
you'll need to store your accounts in a list and loop thru them

private List accounts = new ArrayList();

public void updateAll() {
   Iterator i = accounts.iterator();
   while (i.hasNext()) {
      Account a = (Account) i.next();
      a.update_fields();
   }
}
0
 
Mayank SAssociate Director - Product EngineeringCommented:
You might want to call it on separate threads, though, so that it happens parallelly.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now