Re: Interface to class casts

Tech-Archive recommends: Fix windows errors by optimizing your registry



No, you can't assume that. The only somewhat safe way
to assume no proxy is if your interface does not have
marshaling support (e.g. has the [local] attribute). Even
then, you can still get somebody else's implementation
of the same interface and you are again screwed. Don't
follow Brian's advice.

There's a much more elegant solution for your problem.
It's called persistence. Implement the IPersistXXX
interface required by RDB (IPersistStreamInit for
example, but bear in mind I'm not familiar with RDB)
on your object and work directly through it.

--
=====================================
Alexander Nickolov
Microsoft MVP [VC], MCSD
email: agnickolov@xxxxxxxx
MVP VC FAQ: http://vcfaq.mvps.org
=====================================

"Jack Hughes" <jhughes@xxxxxxxxxxxxxx> wrote in message
news:uw9K7eZOHHA.448@xxxxxxxxxxxxxxxxxxxxxxx
Brian Muth wrote:
"Jack Hughes" <jhughes@xxxxxxxxxxxxxx> wrote in message
news:OPpgxYZOHHA.4848@xxxxxxxxxxxxxxxxxxxxxxx
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?


If you know for sure that the IWheel* pointer is not pointing to a proxy,
then you can use static_cast<CWheel *>. Do not use reinterpret_cast<>.

Brian


Cheers Brian.

I can assume that I am not using a proxy if I am not using COM+ and I am
not using DCOM? Are there any other circumstances when a proxy is
involved?

Jack


.



Relevant Pages

  • Re: Internet Access problems in Fedora Core 4
    ... using the raw ip was to factor out DNS from the troubleshooting. ... set right or your card's interface isn't setup right. ... nameserver <proxy if proxy does dns to you or isp's dns> ... PING 64.233.179.99 56bytes of data. ...
    (comp.os.linux.misc)
  • Re: Should proxy have one interface or two
    ... Dual firewall will help you grant access to public resource/client and limit ... Vérificateur interne en sécurité de l'information ... A Proxy is a device that takes a connexion, filters it and sends it to the ... That's why you have 2 interface, to prevent the bypassing of the proxy, to ...
    (Security-Basics)
  • Re: UML Question (Object <-> ObjectFinder?)
    ... just delegates all method calls to the proxy, ... I could even use an interface here. ... It dispatches to UserFinder.findUserByName, which, in turn, creates the right command string and invokes Proxy.doIt. ... The findUserByName subsystem interface method could form the command string and invoke Proxy.doIt directly. ...
    (comp.object)
  • Re: How to do non dependence on database vendor?
    ... >>> You could actually get away with only a single proxy if you use ... >> The interface approach seems more scalable and contained. ... >>> layer, focusing on storing and retrieval of the explicit data, but free ... >>> the future want to make use of another DB than those supporting SQL. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Design Pattern Question
    ... but Proxy is pretty much designed for restricted or selective access. ... interfaces for Employee that only provide X, X+Y, or Z access. ... one "hard-wires" the appropriate interface for each client. ... I would like to explore this design further. ...
    (comp.object)