Interface to class casts



I have a couple of C++ classes CCar and CWheel implementing the ICar and IWheel interfaces respectively.

One of ICar methods (and implemented by CCar) is AddWheel(IWheel* aNewWheel).

One of the problems I have is that I need to access the CWheel class instead of just going through IWheel for doing RDB persistence. I don't want to clutter up the IWheel interface with this kind of implementation detail.

How do I safely go from a IWheel* to the respective CWheel* in the AddWheel method?

As I understand it, IWheel* is a super class of CWheel so one of the C++ casts should do the job?

Any help much appreciated.

Regards,

Jack
.



Relevant Pages

  • Re: Interface to class casts
    ... IWheel interfaces respectively. ... One of ICar methods is AddWheel. ... One of the problems I have is that I need to access the CWheel class instead of just going through IWheel for doing RDB persistence. ...
    (microsoft.public.vc.atl)
  • Re: Interface to class casts
    ... IWheel interfaces respectively. ... One of ICar methods is AddWheel(IWheel* ... One of the problems I have is that I need to access the CWheel class ...
    (microsoft.public.vc.atl)