conrtract A { function test() virtual public pure returns (uint) { return 123; } }…
Jump to turn (6)
- 1conrtract A { function test() virtual public pure returns (uint) { return 123; }
- 2are you sure about the answercoz i think its the wrong answer you gave?
- 3struct Transaction { address receiver; uint8 id; bool isApproved; uint64 amount;
- 4pragma solidity ^0.8.7; contract Test { uint public x = 10; uint public y = 12;
- 5contract Number { uint num1 = 1; uint num2 = 1; function changeNum1(uint num1) p
- 6pragma solidity ^ 0.8.7; contract Owner { address blic owner; uint private code;
- User
conrtract A { function test() virtual public pure returns (uint) { return 123; } }
conrtract B { function test() virtual public pure returns (uint) { return 456; } }
conrtract C is A, B { function test() override (A, B) public pure returns (uint) { return super.test(); } } What does C.test() return?
- Assistant
C.test() will return a compilation error because it is inheriting two contracts (A and B) with conflicting implementations of the 'test()' function. The 'super.test()' in contract C is ambiguous as it does not know which of the two parent contracts to call.
- User
are you sure about the answercoz i think its the wrong answer you gave?