Skip to content

Conversation

rakesh0x7
Copy link
Contributor

Checklist

Describe the changes you've made:

Updated the "Incorrect inheritance" issue with example and mitigation's.

Type of change

Select the appropriate checkbox:

  • Documentation update (improving existing information)

Comment on lines +11 to +47
```solidity
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.16;
contract Final {
uint public a;
constructor(uint f) {
a = f;
}
}
contract B is Final {
int public fee;
constructor(uint f) Final(f) {
}
function setFee() public {
fee = 3;
}
}
contract C is Final {
int public fee;
constructor(uint f) Final(f) {
}
function setFee() public {
fee = 5;
}
}
contract A is B, C {
constructor() B(3) C(5) {
setFee();
}
}
```
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This example doesn't compile for me:

DeclarationError: Identifier already declared.
  --> contracts/Linearization.sol:18:5:
   |
18 |     int public fee;
   |     ^^^^^^^^^^^^^^
Note: The previous declaration is here:
  --> contracts/Linearization.sol:10:5:
   |
10 |     int public fee;
   |     ^^^^^^^^^^^^^^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants