This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Two errors creating a converter between two types


Hi tirengarfio,

You are making a cast operator.

Cast operators have no parameters, hence they are 'void'.

So your int parameter is not allowed.

What would that look like, anyway, when used...

CEntrada* ptr = (CEntrada*) taquilla (7);

...?  Can't be that, since that's not a cast operator.

Must be (although still invalid)...

CEntrada* ptr = taquilla.operator CEntrada*(7);

...which rather defeats the purpose of a cast operator.

Probably should make an accessor:

  CEntrada* GetEntradaPtr(int i);

Or:

  CEntrada* operator [] (int i);

HTH,
--Eljay


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]