I was wondering how I could model agents communicating by sending and receiving messages. For example, say that we have 2 types of agents, buyers and sellers. A seller has an attribute that contains the price of a product. If a buyer wants to ask the price of the product, he should send a message to the seller and the seller should reply by sending back to the buyer a message telling him about the price.
Up to now I have thought that if a buyer wants to use the price of the product (an attribute of the seller) he could just write
a = seller.getPrice();
since the classes buyer and seller are in the same package. However, I think that this is not so realistic because in real applications an agent cannot have access in the attributes of another agent. He can only ask the other agent to give him such information.