Created
February 4, 2024 08:36
-
-
Save soheil-moonesi/11e99c1f4bd2df201de2fb01b97361d5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Without inheritance | |
| public class SavingsAccount | |
| { | |
| private double balance; | |
| public double GetBalance() | |
| { | |
| return this.balance; | |
| } | |
| } | |
| public class CurrentAccount | |
| { | |
| private double balance; | |
| public double GetBalance() | |
| { | |
| return this.balance; | |
| } | |
| } | |
| // With inheritance | |
| public class Account | |
| { | |
| protected double balance; | |
| public double GetBalance() | |
| { | |
| return this.balance; | |
| } | |
| } | |
| public class SavingsAccount : Account | |
| { | |
| // Other specific methods and properties | |
| } | |
| public class CurrentAccount : Account | |
| { | |
| // Other specific methods and properties | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment