I'm deriving a new class from the VCL TStream
class:
// A stream based on a temporary file, deleted when the stream is closed
class TTempFileStream : public TStream
{
...
public:
using TStream::Seek;
__int64 __fastcall Seek(const __int64 Offset, TSeekOrigin Origin)
{
return 0; // for simplicity!
}
...
} ;
TStream
declares the following two variants of Seek:-
virtual int __fastcall Seek(int Offset, System::Word Origin)/* overload */;
virtual __int64 __fastcall Seek(const __int64 Offset, TSeekOrigin Origin)/* overload */;
But I get the following W8022 warning when compiling my class:-
[BCC32 Warning]_utils.h(166): W8022
'_fastcall TTempFileStream::Seek(const __int64,TSeekOrigin)' hides virtual function '_fastcall TStream::Seek(int,unsigned short)'
Surely the Using declaration should fix that?
To drag this question back on track, I'm aware of the way that the two versions of TStream::seek interrelate, and I'm just trying to get inherited Seek(int,int) method exposed by the derived class. Why isn't my using
declaration doing that?
Roddy, your code is very much correct.
The code works as expected (tested) when adding using TStream::Seek; otherwise as the warning states, will hide the base class method. (this part of C++ language, Remy have to disagree for the first time with you).
The warning is a false positive, a very old and not yet correcred BUG in C++ Builder present at least from version 2006 to XE4.