Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 256
  • Last Modified:

Static attributes in delphi ?

Hello
I am a c++ programmer currently working with delphi 2.0.

Is it possible to create a variable in an object that keeps the same value in each  instance of the object, so if you modified the value in one instance the new value would be seen in all of the other instances?

0
essbb
Asked:
essbb
1 Solution
 
StevenBCommented:
 If you declare a variable within an objects unit, not within the object declaration itself, simply within the Interface section then that variable will be global across all objects of that type. The variable will not be a property of the objects in quetion, but you can set up a 'proper' property of the objects and then set the read and write methods of that property to access the global variable.
  If you want any of these points explaining more fully, or some source code then leave a comment to that effect and I'll get back on the case.

  Steven.
0
 
essbbAuthor Commented:
Thanks, that is a great idea.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now