End

Given this declaration, you can use the constructor to create a generic internal object, without knowing its actual type up front, and write:

constructor TConstrClass<T>.Create; begi n val := T.Create; end;

How can we use this generic class and what are the actual rules? In the next example I have defined two classes, one with a default (parameterless) constructor, the second with a single constructor having one parameter: type

TSimpleConst = class publ ic

Value: Integer;

constructor Create; // set Value to l0

Was this article helpful?

0 0
Project Management Made Easy

Project Management Made Easy

What you need to know about… Project Management Made Easy! Project management consists of more than just a large building project and can encompass small projects as well. No matter what the size of your project, you need to have some sort of project management. How you manage your project has everything to do with its outcome.

Get My Free Ebook


Post a comment