Skip to content

Commit 3de30fa

Browse files
committed
S7 on new_object()
1 parent 447cc3f commit 3de30fa

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

R/s7-bank-account.R

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ BankAccount <- S7::new_class(
5757
stop("Initial balance cannot be negative")
5858
}
5959

60-
new_object(
61-
.parent = S7_object(),
60+
S7::new_object(
61+
.parent = S7::S7_object(),
6262
account_number = account_number,
6363
account_holder = account_holder,
6464
balance = initial_balance
@@ -323,7 +323,7 @@ SavingsAccount <- S7::new_class(
323323
))
324324
}
325325

326-
new_object(
326+
S7::new_object(
327327
.parent = BankAccount(account_number, account_holder, initial_balance),
328328
interest_rate = interest_rate,
329329
min_balance = min_balance
@@ -392,8 +392,13 @@ S7::method(add_interest, SavingsAccount) <- function(x, ...) {
392392
invisible(x)
393393
}
394394

395-
# Override account info for SavingsAccount
395+
#' Get Account Information for Savings Account
396+
#'
397+
#' Prints detailed information about the savings account including account number,
398+
#' holder name, balance, interest rate, and minimum balance.
399+
#'
396400
#' @export
401+
#' @noRd
397402
S7::method(get_account_info, SavingsAccount) <- function(x, ...) {
398403
cat("=== Savings Account Information ===\n")
399404
cat(sprintf("Account Number: %s\n", x@account_number))
@@ -463,7 +468,7 @@ CheckingAccount <- S7::new_class(
463468
stop("Initial balance cannot be negative")
464469
}
465470

466-
new_object(
471+
S7::new_object(
467472
.parent = BankAccount(account_number, account_holder, initial_balance),
468473
overdraft_limit = overdraft_limit,
469474
transaction_fee = transaction_fee

man/s7examples-package.Rd

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)