|
From: Marc H. <ma...@e-...> - 2003-07-30 05:07:36
|
Hi All,
As I said, the example was contrived and not useful. Casting to different
int types is not what I had in mind, but it served to get the question
across without declaring 10 different classes and overloading the type
operator. Anyway thanks for the input, everybody. Ioannis' answer was
correct, although it was so brief I had to read it ten times before I
understood what he meant.
__________________________________
Marc Heiligers
-----Original Message-----
From: dev...@li...
[mailto:dev...@li...] On Behalf Of Per
Westermark
Sent: 29 July 2003 20:26
To: Abhijit Shylanath
Cc: Ioannis Vranos; dev...@li...
Subject: RE: [Dev-C++] Overloading ()()
It is valid in the sense that a class shouldn't implement a lot of type
conversions just because it can. It should still be up to the user to
perorm any typecasts from int to xx.
Normally, operator type() is used to perform type-conversions that may not
be performed by a single type-cast - converting an integer to a string, or
an object that encapsulates several sub-objects, for example:
class CSurfInfo;
class CVec3;
class CTransform;
class C3DObject {
public:
operator CSurfInfo&();
operator CTransform&();
operator CVec3&();
};
C3DObject *pObj;
...
setSurface((CSurfInfo*)*pObj);
/Per W
On Tue, 29 Jul 2003, Abhijit Shylanath wrote:
> > operator unsigned char()
> >
> > The return value is the type.
>
> Okay, so my post (argument list should be different, not return type)
isn't
> valid, I guess. Sorry.
>
> --
> Abhijit Shylanath
> Homepage: http://mudeth.tripod.com/
>
>
>
> -------------------------------------------------------
> This SF.Net email sponsored by: Free pre-built ASP.NET sites including
> Data Reports, E-commerce, Portals, and Forums are available now.
> Download today and enter to win an XBOX or Visual Studio .NET.
>
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
|