RE: [Dev-C++] Why doesn't this compile?
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Andrew V. <av...@in...> - 2002-10-09 15:05:30
|
Ummm...MY_TYPE can be any type, change it to "float" if you like,
doesn't make any difference like I said.
I know the constructors etc... aren't strictly needed, they don't stop
it compiling or working though.
Also, the constructors etc... *are* required for the actual
implementation - this is just a stripped down and renamed version for
test perposes.
Oh, and I disagree with the "better to 'return 0'" comment :)
0 is an integer, I know NULL is just #defined as 0, but using NULL
implies a pointer type.
You wouldn't type the following:
UINT I = 27 + NULL;
Would you?, so why write:
UINT *p = 0;
?
-----Original Message-----
From: dev...@li...
[mailto:dev...@li...] On Behalf Of Ioannis
Vranos
Sent: 09 October 2002 15:54
To: 'C++ Dev'
Subject: RE: [Dev-C++] Why doesn't this compile?
> -----Original Message-----
> From: dev...@li...
> [mailto:dev...@li...] On Behalf
> Of Andrew Vidler
> Sent: Tuesday, October 08, 2002 10:53 PM
> To: C++ Dev
> Subject: [Dev-C++] Why doesn't this compile?
>
>
> And more importantly, how can I make it compile?!
>
>
>
> #define MY_TYPE IDirect3DBaseTexture8
>
> class CBase
> {
> public:
> CBase() {}
Not needed.
> virtual ~CBase() {}
Or better: virtual ~CBase();
>
> virtual operator MY_TYPE * () = 0;
Where is IDirect3DBaseTexture8 defined?
> };
>
> class CDerived : public CBase
> {
> public:
> CDerived() {}
> ~CDerived() {}
You can ommit the above two.
>
> operator MY_TYPE * () { return NULL; }
Better: return 0;
IDirect3DBaseTexture8 not defined anywhere.
> };
>
> void test()
> {
> CBase *c = new CDerived();
> MY_TYPE *f = c;
> }
>
>
>
>
> The #define is there purely so I could see if the code compiled with
> different types - it doesn't.
Ioannis
* Ioannis Vranos
* Programming pages: http://www.noicys.freeurl.com
* Alternative URL: http://run.to/noicys
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf _______________________________________________
Dev-cpp-users mailing list
Dev...@li...
TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm
https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
|