Delphi Programming Tutorial #68 - Abusing Typed Constants

preview_player
Показать описание
In this video Alister Christie shows how typed constants can be used like variables (with some compiler directives) and how they have some interesting properties.

Alister Christie is a Delphi MVP (Most Valued Professional), Consultant, Developer, Trainer, Presenter, and Author. He has presented at ADUG (Australasian Delphi Users Group) Symposia and Code Rage Conferences for many years. Alister holds a degree in Mathematics and Computer Science from Victoria University, Wellington. He lives near Wellington, New Zealand.

On this YouTube Channel, Alister has created many hours of video tutorials to help you learn Delphi Programming in efficient and effective ways. Using his lessons, you will programme faster and better, skills applicable for beginners through to experts wanting to expand their programming and coding proficiency.

Video topics by Alister Christie include VCL (Visual Component Library), FireMonkey, FireDAC, Cross-platform, Android, iOS (iPad or iPhone Operating System), Mac OS/X, Windows, IoT (Internet of Things), Algorithms, and more.

Рекомендации по теме
Комментарии
Автор

another way would be(create a new console application):
const counter: Integer = 1; // constant
var pcounter: PInteger; // a pointer to integer
begin
pcounter := @counter; // set reference to counter constant
inc(pcounter^); // dereference the pointer and increment it's value
writeln(counter); // print the new value, it should be 2
readln(); // wait for a RETURN input from user
end;

duminicad
visit shbcf.ru