[DUG] basic question
Alister Christie
alister at salespartner.co.nz
Wed Jul 25 15:55:22 NZST 2007
I've been thinking of doing a number of training movies on OOP, but it's
such a huge topic. I've been trying to keep my videos below 10 minutes
lately so I can put them on YouTube - I'd think about 50-100 movies
would be required to cover OOP properly. Currently there are 16
available (http://codegearguru.com) and I hope to put the 17th online
tonight (owner vs parent) - I've got a long way to go ;-)
Alister Christie
Computers for People
Ph: 04 471 1849 Fax: 04 471 1266
http://www.salespartner.co.nz
PO Box 13085
Johnsonville
Wellington
David Moorhouse wrote:
> The Delphi compiler creates an implicit parameter to Self and places it before the
> other params to the method.
>
> Take a look at the TMethod class to see how this works and can be used successfully
> to redirect code and data.
>
> The code pointer is share by all instances of the object and exists even if the
> object has not been created (just declared). The converse is that each object
> instance has its own data pointer which is not initialised until the object is
> created by the constructor.
>
> To see this in action, change your execute method to access a property/field of
> FormB. Boom !
>
> Compiler magic - we love it !
>
>
> D
>
>
> On Wed, 25 Jul 2007 08:28:03 +0530, you wrote:
>
>
>> Hi,
>>
>> Is it possible to call a method of a class without creating a object of it,
>> even if the method is not a class function in Delphi ? I wrote the below
>> code just to test -
>>
>> 1. Created a simple form A and a button on it.
>> 2. Created another simple form B, written a procedure in it as -
>> FormB.Execute;
>> begin
>> ShowMessage("xyz");
>> end;
>> 3. Commented out auto creation of FormB in application.
>> 4. On Button Click in FormA I called the Execute of FormB and it worked
>> perfectly okay.
>>
>> What could be the reason for this? I had the idea that either I need to
>> create an object before calling any method or I need to declare a class
>> function.
>>
>> In the above steps when I am trying to call Show in Execute function of Form
>> B I got Access violation which is perfectly fine according to the above
>> statement.
>>
>> May be I am missing something simple here, but any pointers will be great.
>> This was done in D2005 and it's win32 app.
>>
>> Thanks
>> -Ani
>>
>
> _______________________________________________
> NZ Borland Developers Group - Delphi mailing list
> Post: delphi at delphi.org.nz
> Admin: http://delphi.org.nz/mailman/listinfo/delphi
> Unsubscribe: send an email to delphi-request at delphi.org.nz with Subject: unsubscribe
>
>
More information about the Delphi
mailing list