Create class

Windows 10 Desktop / XOJO 2018r4
In a module (modDivers) I create a class ‘MyTextInputStream’ with Super TextInputStream and scope Public.
I add a method called 'ReadNextLine’to this new class.

I use following code :

//...
//...
Dim f As FolderItem = GetFolderItem(App.MMUserInstrumentFolder.Child(Instrument + ".dat").NativePath)
Dim stream As MyTestInputStream

stream = MyTextInputStream.Open(f)
//...
//...
stream.Close

FolderItem f is correct and works fine in my program
The line stream = MyTextInputStream.Open(f) is not accepted when compiling.
It says :
Type mismatch error.
Expected class modDivers.MyTextInputStream, but got class TextInputStream.

What am I doing wrong ?
Is it possible to craete a new class MyTextInputStream with Super TextInputStream at all ?
Any help would be welcome.

Thanks
Regards
Etienne

TextInputStream.Open return a TextInputStream - not a “MytextInputStream”

So even though you have subclassed TextInputStream the return type of the Open method does not match the defined type of stream

There are a couple ways to deal with this

  1. add the ReadNextLine" using extends methods

  2. alter your subclass to have an “open” method that does return a “MyTextInputStream”
    How to do this correctly depends on how the rest of this subclass works

I added the ReadNextLine by using the ‘Extends Methods’.
Works fine.
Thank you very much for your help.

Regards
Etienne