-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f0d314a
commit 901e7e0
Showing
1 changed file
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# CalculatorUsingInterface | ||
## Problem Statement | ||
|
||
Writing same contract in different ways increases understanding. | ||
|
||
So, in this problem statement, we will rewrite the Calculator contract using Interface. We will use [this contract from std-2](../../std-2/2_SafeCalculator/SafeCalculator.sol) | ||
|
||
Task is to rewrite the same contract using an `interface`. | ||
|
||
## Informational Hint | ||
|
||
### Interfaces | ||
|
||
Interfaces are similar to abstract contracts, but they cannot have any functions implemented. There are further restrictions: | ||
|
||
- They cannot inherit from other contracts, but they can inherit from other interfaces. | ||
|
||
- All declared functions must be external in the interface, even if they are public in the contract. | ||
|
||
- They cannot declare a constructor. | ||
|
||
- They cannot declare state variables. | ||
|
||
- They cannot declare modifiers. | ||
|
||
Know more: https://docs.soliditylang.org/en/v0.8.20/contracts.html#interfaces |