[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: PSound updates
pcburns@zip.com.au wrote:
>No its like this.
>
>class A
>{
>..
>
> virtual T* Get() const;
>..
>}
>
>class B : public A
>{
>..
> virtual const T* Get() const;
>..
>};
>
>The functions differ only by the type returned. You can't do that.
No it's not.
it's like this:
template <class E> class A
{
// ...
virtual E Get () const;
};
template <class Q> class B : public A<const Q>
{
// ...
virtual const Q Get () const;
};
If you instantiate B with, say, type Directory, then you get:
class B : public A<const Directory>
{
//...
virtual const Directory Get () const;
};
which is derived from
class A
{
// ...
virtual const Directory Get () const;
};
The template parameter for class A is in this case "const Directory", which
means that the Get () method has a return type of "const Directory".
VC++ 5 doesn't seem to get this - it treats the "const" part of the
template parameter as something seperate, and thus everything gets messed
up.
>Is there another bug to do with using a const template type?
I'm pretty sure we all refer to the same one.
Christian
--
Drink wet cement. Get stoned.