Lazarus
Home
Help
TinyPortal
Search
Login
Register
Lazarus
»
Forum
»
Miscellaneous
»
Suggestions
»
LCL
»
inherited
Free Pascal
Website
Downloads
Wiki
Documentation
Bugtracker
Mailing List
Lazarus
Website
Downloads (Laz+FPC)
Packages (OPM)
FAQ
Wiki
Documentation (RTL/FCL/LCL)
Bugtracker
CCR Bugs
GIT
Mailing List
Other languages
Foundation
Website
Useful Wiki Links
Project Roadmap
Getting the Source
Screenshots
How to use the forum
About donations (wiki)
Bookstore
Computer Math and Games in Pascal
(preview)
Lazarus Handbook
Search
Advanced search
WIKI Timeout issues
Please read here if you have trouble connecting to the wiki
Recent
DBF / DBGRID
by
Handoko
[
Today
at 11:36:03 am]
[SOLVED] Are there units ...
by
Gustavo 'Gus' Carreno
[
Today
at 11:16:37 am]
Loop Iteration Speed Test
by
paweld
[
Today
at 11:13:59 am]
Sqlite & Zeos
by
Petrus Vorster
[
Today
at 11:11:58 am]
OpenDialog is too big and...
by
440bx
[
Today
at 11:09:35 am]
Shenanigans with ncurses ...
by
Gustavo 'Gus' Carreno
[
Today
at 11:00:34 am]
Has anyone loaded ReactOS...
by
Thaddy
[
Today
at 10:51:44 am]
Status and Maintenance of...
by
Thaddy
[
Today
at 09:53:53 am]
Inheritance of Classes th...
by
Thaddy
[
Today
at 09:31:25 am]
Trouble compiling fpc for...
by
ermok
[
Today
at 09:22:20 am]
A Tutorial for LazReport
by
Thaddy
[
Today
at 09:12:25 am]
LAMW complaining about "A...
by
Alcatiz
[
Today
at 08:03:36 am]
Hints for method name mis...
by
CM630
[
Today
at 07:55:47 am]
Variable number of button...
by
Martin_fr
[
Today
at 07:41:02 am]
TTask 'file not found' er...
by
Thaddy
[
Today
at 07:09:45 am]
Has the function of findi...
by
gary
[
Today
at 06:02:48 am]
TaurusTLS 1.0.0.25 beta 2...
by
J. Peter Mugaas
[
Today
at 05:26:43 am]
My second "paint" program
by
TBMan
[
Today
at 04:13:41 am]
Zeos 8, Acces violation
by
incendio
[
Today
at 04:08:35 am]
Opencv version 4.6 C++ AP...
by
Mongkey
[
Today
at 02:39:07 am]
TBitBtn no longer shows g...
by
wp
[
Today
at 01:09:04 am]
Modbus summary thread
by
bobby100
[June 22, 2025, 11:18:35 pm]
connection lost
by
ADMGNS
[June 22, 2025, 10:58:19 pm]
How to export Pascal vari...
by
ecm
[June 22, 2025, 09:54:37 pm]
What WinAPI functions can...
by
440bx
[June 22, 2025, 09:01:50 pm]
« previous
next »
Print
Pages: [
1
]
Author
Topic: inherited (Read 11160 times)
=sniper=
Guest
inherited
«
on:
June 18, 2006, 03:09:13 pm »
procedure TSomeClass.MyProc;
begin
inherited;
...
end;
why I had this message "... Error: Abstract methods can't be called directly" but Delphi compile it without problem?
Logged
Almindor
Sr. Member
Posts: 412
RE: inherited
«
Reply #1 on:
June 18, 2006, 03:30:21 pm »
if TSomeClass has a Parent which has
procedure MyProc; virtual; abstract;
then calling "inherited" equals calling an abstract method, which would crash.
If delphi compiles this it means it has less intelligent error handling than FPC.
Logged
Anonymous
Guest
RE: inherited
«
Reply #2 on:
June 18, 2006, 07:33:58 pm »
It look's like this
procedure MyProc(aTime : Integer); override;
Logged
Almindor
Sr. Member
Posts: 412
RE: inherited
«
Reply #3 on:
June 19, 2006, 08:57:37 pm »
I need to see how the parent looks
Logged
Anonymous
Guest
RE: inherited
«
Reply #4 on:
June 19, 2006, 11:13:58 pm »
yes Parent class looks like
procedure MyProc(aElapsedTime : Integer); virtual; abstract;
now what should I do? Delete this inheriteds?
Logged
Anonymous
Guest
RE: inherited
«
Reply #5 on:
June 20, 2006, 07:32:36 am »
Parent class function actually
Logged
Almindor
Sr. Member
Posts: 412
RE: inherited
«
Reply #6 on:
June 20, 2006, 07:58:47 am »
you can't call inherited in a descendent which has abstract method in parent.
Delphi perhaps let you run it but it'd crash on that code.
Logged
RudieD
Full Member
Posts: 234
RE: inherited
«
Reply #7 on:
June 20, 2006, 08:22:15 pm »
No, I think Delphi just ignores it .
Logged
The FRED Trainer. (Training FRED with Lazarus/FPC)
Almindor
Sr. Member
Posts: 412
RE: inherited
«
Reply #8 on:
June 21, 2006, 03:18:34 pm »
well it should throw an exception
Logged
RudieD
Full Member
Posts: 234
RE: inherited
«
Reply #9 on:
June 21, 2006, 07:28:32 pm »
I also like the exception route.
Logged
The FRED Trainer. (Training FRED with Lazarus/FPC)
Marc
Administrator
Hero Member
Posts: 2649
RE: inherited
«
Reply #10 on:
June 23, 2006, 10:49:07 am »
Yes and no.
In most cases you don't have to know what the original function does whan you want to add some functionality. IMO for those cases calling inherited should not raise an exception. (I find the FPC behaviour on this a bit annoying)
Logged
//--
{$I stdsig.inc}
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the
bug tracker
RudieD
Full Member
Posts: 234
RE: inherited
«
Reply #11 on:
June 23, 2006, 05:33:41 pm »
What about a warning message then ? So that if you expect a ancestors method to do something, you will at least know if theres nothing there.
Logged
The FRED Trainer. (Training FRED with Lazarus/FPC)
Almindor
Sr. Member
Posts: 412
RE: inherited
«
Reply #12 on:
June 26, 2006, 05:54:44 pm »
no it should, abstract simply is ment to force programmers to make something. Otherwise use just an empty virtual one.
Logged
Print
Pages: [
1
]
« previous
next »
Lazarus
»
Forum
»
Miscellaneous
»
Suggestions
»
LCL
»
inherited
TinyPortal
© 2005-2018