Casting vs. operator overloading
From: Anand Hariharan (desh_bakth_at_yahoo.com)
Date: 03/31/04
- Next message: Mike Wahler: "Re: Casting vs. operator overloading"
- Previous message: Leor Zolman: "Re: basic i/o question"
- Next in thread: Mike Wahler: "Re: Casting vs. operator overloading"
- Reply: Mike Wahler: "Re: Casting vs. operator overloading"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 31 Mar 2004 09:36:34 -0800
Do the semantics of -
(T) MyObj
or
XXX_cast<T> MyObj
(where XXX is static/dynamic/reinterpret/...) have anything to do with
-
MyObj.operator T()
?
If it does not, is there any way by which I could prevent clients of
my class from casting its instances to another type, and/or delegate
such code to the overloaded operator?
The solutions that I am aware of are -
* Talk to them or get them to talk to you.
* Implement member functions to do what they are really after.
* Document your interfaces.
None of them really are *LANGUAGE* solutions! :(
thank you for listening,
- Anand Hariharan
- Next message: Mike Wahler: "Re: Casting vs. operator overloading"
- Previous message: Leor Zolman: "Re: basic i/o question"
- Next in thread: Mike Wahler: "Re: Casting vs. operator overloading"
- Reply: Mike Wahler: "Re: Casting vs. operator overloading"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|