Need help: got error trying to override a virtual method 
Author Message
 Need help: got error trying to override a virtual method

Using Turbo Pascal 5.5 (for DOS)
I got an error message saying "Header does not match previous
definition",
but the header DOES match.
I tried to override the Write method in an object type descended from
another type that was descended from the bufstream type.
I am 100% sure that it matches, because I copied and pasted that line
from OBJECTS.PAS.
I am also completely sure that the problem can't be something wrong
somewhere else in the program, because if I make a new PAS file
containing nothing
but the type definitions for those 2 types, I get the same error
message.
The only workaround I can think of is to rename the method to Write2
or something. Hardly an acceptable solution.
------------------------------------------------------
uses objects;
TYPE
  bufstream2=object(bufstream)
    procedure Error(Code: Integer); virtual;
    procedure Writeln(var s:string); virtual;
  end;
  bufstream3=object(bufstream2)
    n:integer;
    constructor Init(FileName: FNameStr; Mode, Size:Word);
    procedure Writeln(var s:string); virtual;
    procedure Write(var Buf; Count: Word); virtual; {this gets error
131!?!}
  end;

begin
end.
------------------------------------------------------
uses objects;
TYPE
  bufstream2=object(bufstream)
    procedure Write(var Buf; Count: Word); virtual; {this gets error
131!?!}
  end;

begin
end.
------------------------------------------------------
(both of these get the error)



Fri, 22 Oct 2004 03:46:49 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Need help: got error trying to override a virtual method

2. Need help with virtual method in digital simulation

3. HOW TO: Override a non-virtual event ??? (CW)

4. Overriding static methods...

5. Paint methods, virtual screens and fast scrolling in TPW

6. Dynamic virtual method tables

7. Virtual Method Indexes

8. Getting address of virtual routine at runtime

9. Help! RecordCount Method returns error

10. HELP!!! error with locate method

11. Getting a method's address

12. Getting a method's address

 

 
Powered by phpBB® Forum Software