2

Image contains the error and code i have written. I have use inheritance in my code.

Image contains the error and code i have written. I have use inheritance in my code.

2

You should have owner = msg.sender. Otherwise I get the following error:

Error: Expression has to be an lvalue.
    msg.sender = owner;
    ^--------^

After I get that I get no errors. It makes sense since you want to assign the creator of the contract (i.e. the message sender) to be the owner of the contract.

Where did you use inheritance because I dont see it. Inheritance is something like contract User is mortal{...}

1

I don't have an answer for your question, but try to compile this code in the solidity browser compiler. If it compiles, then there's something wrong with Mist. Here's link to the compiler

Just noticed on line 7 there should be owner = msg.sender

As I understand it you can only deploy one contract per address. It means that you can deploy only User or Mortal contracts. However, you can compile them together(what you're trying to do) and connect them internally.

For example, if you do inside your User contract:

 address mortal = new mortal()

Compiler/EVM will deploy new contract mortal and return it's address which will be available at mortal variable.

Then inside your User contract code you can do things like:

 mortal.kill()
  • When i have run in compiler.I am getting an error of expected primary expressions { at 16:3 ".But still i am not getting how to resolve the same.Help me if you can. – M Pabari Jul 30 '16 at 6:04

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.