[Ethereum] access struct from mapping in a different contract

contract-debuggingsoliditystruct

I want to access / modify data from a contract from another contract.
If you could help me understand the error that would be great!

I get the following error:

Untitled1:33:8: Error: Indexed expression has to be a type, mapping or array >(is function (address) constant external returns (bool,address,uint256,bool))
        if (a.Owners[msg.sender].sub = false){
            ^------^

below is the code :

pragma solidity ^0.4.7;

contract abc{
    struct Owner{
        bool exist;
        address owner;
        uint share;
        bool sub;
    } // un owner as son address et son percent d'ownership

    mapping (address => Owner) public Owners;
    uint public no_owners; 
    uint public no_sub;


    function abc(){ // a l'execution, l'ownership est transferer a l'excecuteur avec 100 shares.
        //initate
    }

    function transfer(address to,uint amount){
        //transfer ownership
    }
}

contract cde{
    mapping (uint => abc) all_cde;
    uint public f;


    function ask_subdivise(abc a){
        //les different owners vont devoir lancer la fonction
        // une fois que tout les owners on lancer la fonction, le lot est diviser.
        if (a.Owners[msg.sender].sub = false){
            a.Owners[msg.sender].sub=true;
            a.no_sub+=1;

        }
    }
}   

Best Answer

Struct structure (...) is internal to the compiled contract and other contracts have no visibility in it.

Instead, you need to have an accessor and mutator functions that unpacks and returns the struct data for you. See this answer for the example.

Related Topic