• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 182
  • 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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

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