AccountgetBalance that returns a uintSavingsAccount that inherits from AccountgetBalance function in SavingsAccountbalance in SavingsAccount initialized to 1000AccountgetBalance that returns a uintSavingsAccount that inherits from AccountgetBalance function in SavingsAccountbalance in SavingsAccount initialized to 1000Account with an abstract function getBalance that returns a uint.Use the abstract keyword before contract. Declare getBalance without a body and mark it virtual.
SavingsAccount that inherits from Account. Add a uint state variable called balance and set it to 1000.Use is Account to inherit. Declare balance as a state variable with initial value 1000.
SavingsAccount, implement the getBalance function to return the balance variable.Use override keyword and return the balance variable.
showBalance in SavingsAccount that returns the result of getBalance(). Then, write a line to call showBalance() and print the returned balance.Create a public function that calls getBalance() and returns its value.
What is the main purpose of an abstract contract in blockchain programming?
Which of the following is the correct syntax to declare an abstract contract in Solidity?
?
Given the following Solidity code, what will be the output when child.getValue() is called?
abstract contract Parent {
function getValue() public virtual returns (string memory);
}
contract Child is Parent {
function getValue() public override returns (string memory) {
return "Hello from Child";
}
}Identify the error in this Solidity code snippet:
abstract contract Base {
function doSomething() public virtual;
}
contract Derived is Base {
// Missing implementation of doSomething
}You want to create a contract system where multiple child contracts share a common function signature but implement it differently. How should you design the parent contract?
Pass the test and this pattern moves unknown