Newsgroups : Borland : borland.public.delphi.rtl.win32 : 2006 Dec : objects and interfaces
| Subject: | objects and interfaces |
| Posted by: | "Frenk" (fren..@volja.net) |
| Date: | Wed, 6 Dec 2006 18:33:45 |
I was looking into "interfaces" territory for a while. I have a simple
question that I don't understand. I have a class with a following
declaration:
TMyClass = class(TComponent, IMyClassInterface) with some functionality
inside a class.
for instantiating a class I declare a variable and make an instance of an
object:
var MyClass : IMyClassInterface
begin
MyClass = CoMyClass.Create();
....
end
The question is how can I get a reference to a base class, named TMyClass.
Is the following syntax ok?
var MyClass : IMyClassInterface;
MyObject: TMyClass;
begin
MyClass = CoMyClass.Create();
MyObject = TMyClass(MyClass ) // is this allowed ?
....
end
Regards,
Frenk