I have a problem like this. I am very new to solidity stuff. I have created two contracts and I have called a one contract function inside another contract. Here I am providing my contracts.

This is my main contract.

pragma solidity ^0.4.17;

contract TrafficFine{
    struct Officer {
        string firstName ;
        string lastName;
        address account;

    address public manager;
    uint public numberOfOffiers;

    mapping(address=>Officer) public officers;

    modifier restricted(){
        require(msg.sender == manager);      

    constructor () public{
        manager = msg.sender;

    function addOfficer(
        string firstName,
        string lastName,
        address officer) public  restricted{


        Officer  memory newOfficer = Officer({

        officers[officer] = newOfficer;

    function getofficer(address officer) public view returns(address){
        address officer1= officers[officer].account;
        return officer1;


This is my second contract.

contract DriverProfile{
    address watch_adrs=0x8c1eD7e19abAa9f23c476dA86Dc1577F1Ef401f5;

     function doFine(uint offenceID,string location,address officer) public{
         TrafficFine trafficfine = TrafficFine(watch_adrs);


contract TrafficFine{
    function addOfficer(string firstName,string lastName,address officer) public;
    function getOfficer(address officer) public;

When I compile the second DriverProfille contract it gives me an error like this.


Can someone help me to solve this problem?. I search a lot to find a solution to this problem. But I was unable to do nothing to this problem. Thank you!!


Your second implementation of TrafficFine does not specify the return value.

Try changing:

function getOfficer(address officer) public;


function getOfficer(address officer) public view returns (address);
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.