Lazarus
Home
Help
TinyPortal
Search
Login
Register
Lazarus
»
Forum
»
Programming
»
General
»
Records and class name
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
[SOLVED] GTK3 : Icons hav...
by
zeljko
[
Today
at 10:40:09 pm]
Debian releases a Gtk3 La...
by
zeljko
[
Today
at 10:32:15 pm]
Getting results from sql ...
by
CraigC
[
Today
at 10:00:24 pm]
add thumb up or like butt...
by
Martin_fr
[
Today
at 09:35:13 pm]
Problem with drawing orde...
by
wp
[
Today
at 06:26:27 pm]
TChart: Wrong default val...
by
wp
[
Today
at 06:22:26 pm]
Hello! Anything new?
by
simone
[
Today
at 05:47:57 pm]
LAMW Foreground service -...
by
Mongkey
[
Today
at 05:40:05 pm]
could Ardour's YTK be use...
by
Fred vS
[
Today
at 04:59:52 pm]
Any way to "embed" Window...
by
myisjwj
[
Today
at 02:50:41 pm]
mORMot again (HttpServer/...
by
ttomas
[
Today
at 12:45:49 pm]
Is it me or is there some...
by
Martin_fr
[
Today
at 11:48:04 am]
Exiting HeapTrace dump
by
jamie
[
Today
at 11:34:49 am]
CONCAT formula
by
Zvoni
[
Today
at 08:17:21 am]
emuloader: help to resurr...
by
arcadegamer
[March 15, 2026, 08:30:31 pm]
AutoSize TMemo.Height?
by
wp
[March 15, 2026, 05:55:05 pm]
Initialization & finaliza...
by
Martin_fr
[March 15, 2026, 05:24:36 pm]
Possible Enhancement to t...
by
jamie
[March 15, 2026, 04:10:38 pm]
lazarus 4.99 and missing ...
by
wp
[March 15, 2026, 03:11:43 pm]
Questions about TFuncSeri...
by
hedgehog
[March 15, 2026, 06:58:29 am]
CryptoLib4Pascal
by
Xor-el
[March 14, 2026, 06:17:32 pm]
Extended Module Player
by
Gigatron
[March 14, 2026, 05:32:06 pm]
[AGGPas] Difference betwe...
by
Roland57
[March 14, 2026, 04:36:02 pm]
« previous
next »
Print
Pages: [
1
]
Author
Topic: Records and class name (Read 6523 times)
Dibo
Hero Member
Posts: 1057
Records and class name
«
on:
October 16, 2010, 10:39:33 am »
Hi,
Are records store information of own class name? I mean, in standard object I have such functions as ClassName, ClassType, InheritsFrom. Can I somehow read this information from the records?
Regards
Logged
theo
Global Moderator
Hero Member
Posts: 1937
Re: Records and class name
«
Reply #1 on:
October 16, 2010, 10:50:45 am »
How can a record have a classname?
A record is not a class.
Logged
Dibo
Hero Member
Posts: 1057
Re: Records and class name
«
Reply #2 on:
October 16, 2010, 11:12:20 am »
Yes, but I was wondering if there is any way to check type of record
Logged
Martin_fr
Administrator
Hero Member
Posts: 12209
Debugger - SynEdit - and more
Re: Records and class name
«
Reply #3 on:
October 16, 2010, 11:30:39 am »
No there isn't.
And there is (should be) no need.
You know the type.
var a: TFooRecord;
"a" will always contain a TFooRecord, never anything else
var a: TFooClass
"a" could contain TInheritedFromFooClass., so you do not know.
There is of course a case: if you use untyped pointers, then you may not know what your pointer points too.
Logged
Ide Tools, Code completion and more
/
IDE cool features
/
Debugger Status
Leledumbo
Hero Member
Posts: 8835
Programming + Glam Metal + Tae Kwon Do = Me
Re: Records and class name
«
Reply #4 on:
October 18, 2010, 04:47:47 am »
There is actually, through RTTI. But that's not necessary in most cases. For classes, ClassType, ClassName, InheritsFrom etc. exist due to dynamic behavior of a class. The case is not the same with record since record doesn't have inheritance.
Logged
Follow this if you want me to answer:
http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F
http://pascalgeek.blogspot.com
https://bitbucket.org/leledumbo
https://github.com/leledumbo
Code first, think later - Natural programmer B)
Martin_fr
Administrator
Hero Member
Posts: 12209
Debugger - SynEdit - and more
Re: Records and class name
«
Reply #5 on:
October 18, 2010, 10:20:11 am »
Quote from: Leledumbo on October 18, 2010, 04:47:47 am
There is actually, through RTTI.
You are referring to classes, records, or both?
That there is for classes was never disputed, but neither in question.
If you refer to Records, then that's news to me...
Logged
Ide Tools, Code completion and more
/
IDE cool features
/
Debugger Status
Leledumbo
Hero Member
Posts: 8835
Programming + Glam Metal + Tae Kwon Do = Me
Re: Records and class name
«
Reply #6 on:
October 19, 2010, 04:06:18 am »
Quote
If you refer to Records, then that's news to me...
Yes, I'm referring to records. AFAIK RTTI works for ANY type.
Logged
Follow this if you want me to answer:
http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F
http://pascalgeek.blogspot.com
https://bitbucket.org/leledumbo
https://github.com/leledumbo
Code first, think later - Natural programmer B)
xenblaise
Sr. Member
Posts: 358
Re: Records and class name
«
Reply #7 on:
October 19, 2010, 07:13:53 am »
Something like this?
//Class;
type
TTemplate = class
public
tpt: Pchar;
size: Integer;
id: Integer;
constructor Create;
destructor Destroy; override;
end;
TDBClass = class
private
dsTemplates: TSQLQuery;
connection: TODBCConnection;
SQLTransact: TSQLTransaction;
tptBlob: TTemplate;
public
function openDB(): boolean;
procedure closeDB();
end;
//Record;
type
TCars = record
name: string[30];
price: Integer;
end;
ShowRoom = array of TCars;
var
CarRoom: ShowRoom;
Logged
Print
Pages: [
1
]
« previous
next »
Lazarus
»
Forum
»
Programming
»
General
»
Records and class name
TinyPortal
© 2005-2018