Iv. abstract classes and instances of it
Delphi has a class called abstract class, you can not naïve directly create an instance for it, such as
var strlst:tstring;begin strlst:= tstring.create; Strlst.add (' I love China '); Strlst.free;end;
This is wrong, because Tstring is an abstract class.
So how do you construct an instance for such an abstract class? The answer is to use its non-abstract subclasses. We know that Tstring has a non-abstract subclass of Tstringlist. So you can do this.
var strlst:tstring; Or can be declared through the abstract class //or directly with Strlst:tstringlist; But the former better some begin strlst:= tstringlist.create; However, creating a concrete object must use a non-abstract subclass of the abstract class //And the created instance is in memory the structure of its subclass, //Although the abstract class declaration is used in Var, but the specific create is its non-abstract subclass Strlst.add (' I love China '); Strlst.free;end;
Talk about classes and objects in Delphi: Iv. abstract classes and their examples