1

This question already has an answer here:

I tried many variants of DELEGATECALL, but not one of them gave me the desired result. When used in assembly: = delegatecall (), I also don't get the result. I also used different versions of Solidity (^ 0.4.13 - ^ 0.5.0). That didn't help either.

Is there a working example of DELEGATECALL? And does DELEGATECALL work today?

**

contract A{
uint256 public N;

     function C(uint256 _c) public{
         N = _c;
     }
}

**

contract B{

    function DelCall(address _contractA, uint256 _c) public{
         _contractA.delegatecall(bytes4(keccak256("C(uint256)")), _c);
         // DELEGATECALL - not works
    }
    function DelCal_B(address _contractA, bytes _b){
         _contractA.delegatecall(_b);
         // DELEGATECALL - not works
    }


    function Call(address _contractA, uint256 _c){
         _contractA.call(bytes4(keccak256("C(uint256)")), _c); 
         // CALL - works
    }
    function Cal_B(address _contractA, bytes _b){
         _contractA.call(_b);
         // CALL - works
    }
}

marked as duplicate by Paul Razvan Berg, shane, Achala Dissanayake, Richard Horrocks, Briomkez Nov 19 '18 at 11:03

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.