- I have a
File
class that has anOpen()
method. - I have a subclass
of
File
calledTextFile
that implements anIReadableFile
interface, which requires the implementation of aRead()
method.
If I declare a variable myFile
as IReadableFile
, I can't call the Open()
method on it. I want to be able to exercise the functionality of TextFile
's base class (File
) methods and its interface (IReadableFile
) methods at once. Is this possible?
EDIT: I'm working in VB.NET (if that matters).
I'm trying to provide a minimum set of File I/O functionality via a File class and then provide extended capabilities for particular types of files by deriving from File and adding some additional methods (like Read, Write, etc.). I want the derived classes to be polymorphic - e.g., calling the Write method on a TextFile will simply write the text data to the filesystem, whereas calling the Write method on a BinaryFile might base 64 encode the binary data before writing it to the filesystem.