Object Oriented Programming Example
Object Oriented Programming Example
example
Create a class that keeps track of a bank account balance. Then write a program to use this
class.
Steps involved:
Kalyan [email protected]
Define 3 methods DEPOSIT, SET_BALANCE and WITHDRAW.
Place the mouse cursor in DEPOSIT and hit the Parameters button.
And WITHDRAW
Kalyan [email protected]
For withdraw we define an exception.
Kalyan [email protected]
Now we are almost done creating the object. Press CTRL + F3 to activate or hit the Matchstick.
Now we are done building the global class we can test it. Press F8.
Kalyan [email protected]
We come back to Initial Screen. Now click DEPOSIT.
Kalyan [email protected]
We get an exception.
Given below is an example code for using the global class we defined.
REPORT ZGB_OOPS_BANK .
start-of-selection.
Kalyan [email protected]
Kalyan [email protected]