Lazarus
Home
Help
TinyPortal
Search
Login
Register
Lazarus
»
Forum
»
Free Pascal
»
Beginners
(Moderators:
FPK
,
Tomas Hajny
) »
Overriding does not work [SOLVED]
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
Forum Rules
About donations (wiki)
Bookstore
Computer Math and Games in Pascal
(preview)
Lazarus Handbook
Search
Advanced search
Recent
GTK3 is now the default w...
by
zeljko
[
Today
at 03:40:04 pm]
Computers sure have come ...
by
Zvoni
[
Today
at 03:36:38 pm]
Putting a new file on a w...
by
J-G
[
Today
at 02:43:35 pm]
KOL x64
by
Thaddy
[
Today
at 02:06:48 pm]
Install new .deb over exi...
by
dbannon
[
Today
at 01:45:27 pm]
FastCGI vs. CGI
by
egsuh
[
Today
at 12:45:05 pm]
Is this safe, changing fr...
by
Thaddy
[
Today
at 10:29:55 am]
Many recent books on Laza...
by
Thaddy
[
Today
at 08:47:32 am]
Difference between @ and ...
by
DavidTh30
[
Today
at 07:58:00 am]
try/except error
by
Thaddy
[
Today
at 07:23:48 am]
How to connect to MariaDb...
by
Thaddy
[
Today
at 07:18:13 am]
docking IDE
by
kapibara
[
Today
at 04:20:33 am]
Isn’t this funny?
by
Joanna
[
Today
at 12:04:29 am]
Error when opening a proj...
by
Tomu
[July 15, 2026, 09:36:13 pm]
Slow app start on M5 MacB...
by
Thaddy
[July 15, 2026, 03:36:57 pm]
Solpage
by
munair
[July 15, 2026, 01:47:30 pm]
Need help with fphttpserv...
by
Thaddy
[July 15, 2026, 12:58:30 pm]
Freepascal
by
Thaddy
[July 15, 2026, 12:39:23 pm]
Lazarus interface to Rexx...
by
Thaddy
[July 15, 2026, 12:38:10 pm]
Parsing error?
by
Thaddy
[July 15, 2026, 12:02:02 pm]
is there PDS reader/expor...
by
cdbc
[July 15, 2026, 10:55:30 am]
Peculiarities in the EXE ...
by
marcov
[July 15, 2026, 09:57:51 am]
Conscious Artificial Inte...
by
schuler
[July 14, 2026, 11:40:27 pm]
Lazarus Bugfix Release 4....
by
Martin_fr
[July 14, 2026, 10:55:23 pm]
equivalent to C/C++ "offs...
by
Thaddy
[July 14, 2026, 07:37:23 pm]
« previous
next »
Print
Pages: [
1
]
Author
Topic: Overriding does not work [SOLVED] (Read 1826 times)
CodenameLambda
Newbie
Posts: 2
Overriding does not work [SOLVED]
«
on:
April 10, 2016, 02:50:19 pm »
Hello,
I have a little problem:
Code: Pascal
[Select]
[+]
[-]
type
TFormula
=
class
private
atoms
:
TAtomCollection
;
position
:
TPoint
;
mouse_position
:
TPoint
;
public
constructor
Create
(
)
;
constructor
FromData
(
atoms_data
:
TAtomCollection
;
position_data
:
TPoint
;
mouse_position_data
:
TPoint
)
;
function
AddAtom
(
atom_type
:
integer
;
atom_position
:
TPoint
)
:
integer
;
// returns the new id
procedure
AddBonds
(
atom1
:
integer
;
atom2
:
integer
;
amount
:
integer
)
;
procedure
RemoveAtom
(
atom_id
:
integer
)
;
procedure
RemoveBonds
(
atom1
:
integer
;
atom2
:
integer
)
;
function
BondAmount
(
atom1
:
integer
;
atom2
:
integer
)
:
integer
;
procedure
MoveTo
(
new_position
:
TPoint
)
;
procedure
Shift
(
delta
:
TPoint
)
;
function
GetPosition
(
)
:
TPoint
;
procedure
Draw
(
canvas
:
TCanvas
;
width
:
integer
;
height
:
integer
)
;
procedure
MouseMove
(
new_position
:
TPoint
)
;
procedure
Click
(
)
;
function
ToLewis
(
)
:
TFormula
;
function
ToStructure
(
)
:
TFormula
;
destructor
Destroy
(
)
;
override
;
end
;
type
TLewis
=
class
(
TFormula
)
public
procedure
Draw
(
canvas
:
TCanvas
;
width
:
Integer
;
height
:
Integer
)
;
override
;
// Lazarus says that it doesn't find any methods to override
procedure
Click
(
)
;
override
;
// same
end
;
How can I fix this?
Thanks,
CodenameLambda
«
Last Edit: April 10, 2016, 03:01:37 pm by CodenameLambda
»
Logged
marcov
Administrator
Hero Member
Posts: 12948
FPC developer.
Re: Overriding does not work
«
Reply #1 on:
April 10, 2016, 02:52:59 pm »
Declare "click" virtual in TFormula.
Override always only overrides virtual methods, and default methods are not virtual
Logged
CodenameLambda
Newbie
Posts: 2
Re: Overriding does not work
«
Reply #2 on:
April 10, 2016, 02:55:10 pm »
Thanks ^^
Logged
Print
Pages: [
1
]
« previous
next »
Lazarus
»
Forum
»
Free Pascal
»
Beginners
(Moderators:
FPK
,
Tomas Hajny
) »
Overriding does not work [SOLVED]
TinyPortal
© 2005-2018