Skip to contents

Transfers a specified amount from one account to another.

Usage

transfer(from, ...)

Arguments

from

A BankAccount object (source account).

...

Additional arguments passed to methods.

Value

A list containing the updated 'from' and 'to' account objects (invisibly).

Examples

account1 <- BankAccount("ACC123", "John Doe", 1000)
account2 <- BankAccount("ACC456", "Jane Smith", 500)
transfer(account1, account2, 200)
#> Transferred $200.00 from ACC123 to ACC456
#> ACC123 new balance: $800.00
#> ACC456 new balance: $700.00