Board index » cppbuilder » How to create a decadent class from TStream?

How to create a decadent class from TStream?


2005-08-23 01:21:09 AM
cppbuilder21
Hi!
I want to create a decadent class from TStream.
I allways get an error message in my main function:
MyOwnStream=new TMyOwnStream("c:\\test.data");
E2352: Cannot create instance of abstract class 'TMyOwnStream'
E2353: Class 'TMyOwnStream' is abstract because of '__fastcall
TStream::Read(void *,int)=0'
My source:
class TMyOwnStream : public TStream
{
private:
AnsiString m_filename;
public:
__fastcall TMyOwnStream(AnsiString Filename) {m_filename=Filename;}
};
Can someone give me an example how to solve this?
Thanks
Johannes Wierer
 
 

Re:How to create a decadent class from TStream?

Johannes Wierer wrote:
Quote
Hi!

I want to create a decadent class from TStream.

I allways get an error message in my main function:

MyOwnStream=new TMyOwnStream("c:\\test.data");

E2352: Cannot create instance of abstract class 'TMyOwnStream'
E2353: Class 'TMyOwnStream' is abstract because of '__fastcall
TStream::Read(void *,int)=0'
TSream is an abstract class, i.e. some of the member functions are
abstract.
The second error message is telling you that you did not implement the
__fastcall TMyOwnStream::Read(void *, int) member function, which is
abstract in the TStream class. If you don't implement it, your class is
abstract as well.
--
Rudy Velthuis [TeamB] rvelthuis.bei.t-online.de
"Perfection is achieved, not when there is nothing more to add, but
when there is nothing left to take away."
- Antoine de Saint Exupéry
 

Re:How to create a decadent class from TStream?

"Johannes Wierer" < XXXX@XXXXX.COM >wrote in message
Quote
MyOwnStream=new TMyOwnStream("c:\\test.data");

E2352: Cannot create instance of abstract class 'TMyOwnStream'
E2353: Class 'TMyOwnStream' is abstract because of '__fastcall
TStream::Read(void *,int)=0'
The error is telling you the exact problem - your descendant class is not
overriding TStream's abstract Read() method. You need to do so.
Gambit
 

{smallsort}