Tuesday, 11 October 2022

What is Reintroduce ?

 A derived class uses the reintroduce directive to hide the name of a virtual or dynamic method was declared in a base class.

Example:-

 type

  TBooks = class

    public

      procedure Add(Item: Integer); virtual;

  end;

  TMathBook = class

    public

      // The TMathBook.Add method hides TBooks.Add, so that compiler warn you about this.

      procedure Add(Item: Single);reintroduce;

  end;

Thursday, 29 September 2022

What is difference between Virtual and Dynamic ?

 virtual and dynamic methods are semantically equivalent. However, they differ in the implementation of method-call dispatching at run time: 

virtual methods optimize for speed, while dynamic methods optimize for code size.

About the design patterns and its Type

In software engineering, a design pattern is a general repeatable solution to a commonly occurring problem in software design. A design pattern isn't a finished design that can be transformed directly into code. It is a description or template for how to solve a problem that can be used in many different situations.

Object oriented design patterns typically show relationships and interactions between classes or objects, without specifying the final application classes or objects that are involved.

  • Singleton :- A class of which only a single instance can exit.
  • Abstract Factory :- Create an instance of several families of classes.
  • Factory Method :- Create an instance of several derived classes.
  • Builder :- Separates object construction from its representation.
  • Prototype :- A fully initialized instance to be copied or cloned.
  • Object Pool :- Avoid expensive acquisition and release of resources by recycling objects that are no longer use. 

Tuesday, 28 October 2014

How can fetch Top N Records from database. ?

Q) How can fetch Top N Records from database. ?
Ans :- Returning only the first N records in a SQL query differs quite a bit between database platforms. Here's some samples:
  
Microsoft SQL Server
    SELECT TOP 10 column FROM Table-name 
PostgreSQL and MySQL
    SELECT column FROM Table-name LIMIT 10
Oracle
SELECT column FROM Table-name WHERE ROWNUM <= 10
Firebird
SELECT FIRST 10 column FROM table
InterBase 
SELECT * FROM Table-name rows 10

Thursday, 15 May 2014

Q :) How to create table in firebird database ?
Ans :-  create table teacher(
 uid int not null,
 pid int,
 Fname varchar(50),
 Lname varchar(50),
 Qualification char(10),
 dob date,
 Address varchar(150),
 pincode char(10),
 dist varchar(50),
 state varchar(50),
 officePhNo varchar(50),
 phno varchar(50),
 mobile varchar(50),
 emailID varchar(50),
 lastupdation timestamp,
 modby varchar(50));

 alter table teacher add constraint pk_TeacherUID primary key (uid)

 create generator gn_TeacherUID

 create trigger tggBI_TeacherUID for teacher
 active before insert position 0
 as
 begin
   if (new.UID is null) then
   begin
    new.uid = gen_id(gn_teacheruid,1);
   end
 end;

Thursday, 17 April 2014

Q) How to create TStringList in delphi ?
Ans) procedure GoodTStringListUsing;
    var
      X: TStringList;
      i: Integer;
    begin
      X := TStringList.Create;
      try
        X.Add('Animals');
        X.Add('Flowers');
        X.Add('Cars');
        X.Sort; { Find will only work on sorted lists! }

        Memo1.Clear;
      for i:=0 to X.Count-1 do begin
         Memo1.Lines.Add(X.Strings[i]);
   end;
     finally
       X.Free;
   end;
end;


Sunday, 2 February 2014

Q) Explain about Delphi`s VCL?
Ans. Delphi is easier to use rather than the API`s. It has strong windows connection and Borland has made things possible for portability on windows. It has a strong library and it maps windows 32. It supports API`s for properties and events. Borland is taking enough measures for back portability for windows.