Structure Inheritance

SilentCiceroSilentCicero Toronto, CAMember Posts: 159 ✭✭✭
I know the DEV team has a lot on their plate right now, but what about the possibility of a structure inheritance.

contract A{
struct Automobile{}
struct Car is Automobile{}
}

Comments

  • SilentCiceroSilentCicero Toronto, CAMember Posts: 159 ✭✭✭
    I see it being feasible on the back-end but I cant tell, given the nature of Solidity, if its in the best interests of the language architecture. Anyways, seems like it would be useful regardless.
  • SilentCiceroSilentCicero Toronto, CAMember Posts: 159 ✭✭✭
    edited March 2015
    Just discovered this example:
    contract InfoFeed {
      function info() returns (uint ret) { return 42; }
    }
    contract Consumer {
      InfoFeed feed;
      function setFeed(address addr) { feed = InfoFeed(addr); }
      function callFeed() { feed.info.value(10).gas(800)(); }
    }
    
    So I now have no need for structure inheritance. Love solidity. Cheers.
    Post edited by StephanTual on
  • StephanTualStephanTual London, EnglandMember, Moderator Posts: 1,282 mod
    I've updated your last post to demo the 'code' formatting (you can find it in the WYSIWYG editor of the forum, the icon between unordered list and smiley).
  • oomooomo Member Posts: 31
    @SilentCicero Yes, it does the job - but the example you provided is more of an "Has-A" characteristic and not a n "Is-A", which is a real inheritance.
Sign In or Register to comment.