toHash() and Interfaces

Nrgyzer nrgyzer at gmail.com
Thu May 5 14:03:51 PDT 2011


Hey guys,

I'm trying to call toHash() in a class which receives an interface
class as input param. But I always get "Error: no property 'toHash'
for type...".

My code looks like:

module iFBlock;

private {
   import std.stream;
}

interface IFBlock {
   public {
      void write(Stream);
   }
}

module myFile;

private {
   import iFBlock;
}

class MyFile {
   private {
       IFBlock[hash_t] pBlocks;
   }
   public {
       void addBlock(IFBlock b) {
           pBlocks[b.toHash()] = b;
       }
   }
}

Is there any chance to get the hash of the FBlock-interface?

Thanks in advance!


More information about the Digitalmars-d-learn mailing list