title: Delphi - Inheritance function result
body: <p>Hi all this is a Delphi code</p>
  
  <p>what is The error is this code ...</p>
  
  <p>The result of Templyoe.fullName Function Not show the inherited result of Tperson.fullname Function what is the reason???</p>
  
  <p>any help plz??
  ..........................................................................................................................................................................................................................................................................................................................................</p>
  
  <pre><code> program classes;
  
  {$APPTYPE CONSOLE}
  
  uses
    SysUtils;
  
  type
    Tperson = class(TObject)
      firstName : string;
      lastName : string;
      function fullName : string ; virtual;
    end;
  
  
    Temploye = class (Tperson)
    function fullName : string ; override;
    end;
  
    var
    person : Tperson;
    Emp : Temploye;
  
  
  { Tperson }
  function Tperson.fullName: string;
  begin
      result := firstName + ' ' + lastName;
  end;
  
  { Tempolye }
  
  function Temploye.fullName: string;
  begin
  result := 'hi ' + inherited fullName + ' You are in Temploye Function';
  end;
  
  
  begin
  
    person := Tperson.Create;
  
    person.firstName := 'code';
    person.lastName := 'programmer';
  
    writeln(person.fullName);
    person.Free;
    Emp := Temploye.Create;
  
  
  
    writeln(emp.fullName);
    emp.Free;
  
    readln;
  
  end
  </code></pre>