Ali Keshavarz's Website
RSS icon Home icon
  • Different function parameter modifiers in Delphi

    Posted on August 2nd, 2010 Ali Keshavarz 6 comments

    Recently a friend asked me about constant parameters in Delphi functions, that brought the idea of writing a new post about passing parameters to functions/procedures in Delphi.

    Parameter modifiers

    When you call a function or procedure (I am going to refer to both of them as Functions here), you have to somehow pass the required input or output parameters to it. Parameters are passed to functions either by value, or by reference.

    Passing by value means, compiler makes a new copy of the original data, and sends it to the function. This way, the function has its own copy of data, and changing value of the parameter inside the function does not affect the original data. This is the default mode when you pass a parameter to a function in Delphi: Read the rest of this entry »

  • اینترفیس ها در دلفی

    Posted on March 18th, 2009 Ali Keshavarz 5 comments

    در این مقاله تعریف مختصری از مفهوم Interface و Abstract Class در طراحی نرم افزار ارائه می کنیم، و سپس به قابلیت های نوع Interface در دلفی و برخی کاربردهای آن، با ذکر مثال، می پردازیم.

    مقدمه

    نوع Interface از نسخه ۳ به دلفی اضافه شد تا پشتیبانی از تکنولوژی COM شرکت مایکروسافت در دلفی فراهم شود. Interface علاوه بر پشتیبانی از COM، قابلیت های جالبی برای برنامه نویسان دلفی به ارمغان آورد که کمتر از آن استفاده می شود. متاسفانه به دلیل آنکه چارچوب اصلی VCL و بخصوص کامپوننت های کار با بانک اطلاعاتی دلفی مدت ها قبل از آن (از نسخه اول دلفی) ایجاد شده بودند، استفاده چندانی از Interfaceها در VCL صورت نگرفت.

    برای درک بهتر interface ها، و قبل از آنکه به تعریف Interface و کاربردهای آن بپردازیم، ابتدا به مفهوم کلاس های Abstract و تعریف آنها اشاره ایی خواهیم داشت؛ زیرا مشابهت هایی در کاربرد این دو مفهوم وجود دارد، و شناخت مفهوم کلاس های Abstract درک مفهوم Interfaceها را ساده تر می کند.

    Read the rest of this entry »