PDA

View Full Version : Inherited چه می کند؟



MSK
شنبه 24 مرداد 1383, 18:05 عصر
با سلام به جمیع دوستان.

می شه به من در مورد کار Inherited ٬ مورد استفادش و ... کمی کمک کنید :?:
{البته اگه از سواد دوستان کم نمی شه«با عرض پوزش از بزرگان :oops: »}

مهدی کرامتی
شنبه 24 مرداد 1383, 22:06 عصر
برای اینکه از علمم کم نشه از راهنمای دلفی برات نقل قول میکنم:

<span dir=ltr>The reserved word inherited plays a special role in implementing polymorphic behavior. It can occur in method definitions, with or without an identifier after it.

If inherited is followed by the name of a member, it represents a normal method call or reference to a property or field--except that the search for the referenced member begins with the immediate ancestor of the enclosing method's class. For example, when

inherited Create(...);

occurs in the definition of a method, it calls the inherited Create.

When inherited has no identifier after it, it refers to the inherited method with the same name as the enclosing method or, if the enclosing method is a message handler, to the inherited message handler for the same message. In this case, inherited takes no explicit parameters, but passes to the inherited method the same parameters with which the enclosing method was called. For example,

inherited;

occurs frequently in the implementation of constructors. It calls the inherited constructor with the same parameters that were passed to the descendant.</span>
:)

_alish_
یک شنبه 25 مرداد 1383, 06:57 صبح
inherited به معنی به ارث برده شده، است به طور عامیانه یعنی کارها یا فرامین پدر خود را انجام دهد(در مورد توابع و پروسیجری که از پدر خود Override شده)

construcure TF.create...
begin
inherited یعنی طبق دستورات پدر (در constructorپدر) عمل کن
F.left:=10; بعد تغییرات مرا اعمال کن
...
end;
ولی بهترین توضیح همان Help دلفی می باشد من فقط به طور مختصر گفتم تا سر نخ وکلیات دستت بیاید

MSK
چهارشنبه 28 مرداد 1383, 13:15 عصر
از همه دوستانی که بدون توقع اطلاعاتشون رو در اختیار دیگران قرار میدن واقعا کمال تشکر رو دارم و از alish
هم که این قدر کوتاه و مفید جواب میده ممنونم :lol:
:flower: :flower: :flower: