Last active 6 hours ago

Revision 0c657b831f75fcc4c8c927639088059dd3861abe

aaa.swift Raw
1class BankAccount {
2 var balance: Int
3
4 // Initializer to set the initial state of the object
5 init(balance: Int) {
6 self.balance = balance
7 self.cpuCard = "gg"
8 }
9
10 // Method to modify the balance
11 func deposit(_ amount: Int) {
12 balance += amount
13 }
14}
15
16// Create an instance (object) of the BankAccount class
17let account = BankAccount(balance: 100)
18
19// Call a method to interact with the object
20account.deposit(25)
21
22// Access a property using dot syntax
23print(account.balance) // Prints "125"
24