Questions tagged [override]

override is a keyword that is used the mark functions whose logic is overriding functions of the same signature in inherited contracts.

Filter by
Sorted by
Tagged with
0
votes
0answers
11 views

How to correctly override in solidity 0.6?

I am looking at Quickswap code in in my local truffle folder which has solidity version > 0.6 When I try to compile it, I am getting an override error. What's the correct way to override (see ...
0
votes
1answer
26 views

Override inherited function visability

I have a contract that looks like this: pragma solidity ^0.6.0; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; contract SwappableToken is ERC20 { constructor(string memory name, ...
17
votes
1answer
10k views

What are the virtual and override keywords in Solidity?

Solidity 0.6.0 introduced the keywords virtual and override. What do they do?
0
votes
1answer
157 views

Interface overriding

I have two contracts. One of them inherits another. Inside the parent contract I have the interface interface Token { function transfer(address to, uint256 value) external returns (bool); } I ...
5
votes
1answer
3k views

Override parent method and modifiers

For example, we have a contract: contract A { modifier checkCaller() { require(msg.sender == 0x123); _; } function doSmth() checkCaller {} } We make child contract and ...
0
votes
1answer
880 views

Call derived function from base contract

I have the following smart contracts: pragma solidity ^0.4.11; contract base { uint public v; separate public mySep; function base() { mySep = new separate(); } ...