0
It is a simple class with get and set methods, but it generates an error when invoking any of the functions or procedures (at first I thought this only on line 43).
unit uPais;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Dialogs;
type
Pais = class
private
codigo:integer;
descricao:string;
public
constructor Create; // construtor
destructor Destroy; // destrutor
// Setters
procedure setCodigo(pCodigo:integer);
procedure setDescricao(pDescricao:string);
// Getters
function getCodigo():integer;
function getDescricao():string;
end;// fim da classe
implementation
constructor Pais.Create();
begin
codigo := 0;
descricao := '';
end;
destructor Pais.Destroy();
begin
//Freemem(@codigo);
//Freemem(@descricao);
end;
// Setters
procedure Pais.setCodigo(pCodigo:integer);
begin
codigo := pCodigo;
end;
procedure Pais.setDescricao(pDescricao:string);
begin
descricao := pDescricao;
end;
// Getters
function Pais.getCodigo():integer;
begin
Result := codigo;
end;
function Pais.getDescricao():string;
begin
Result := descricao;
end;
end.
I think you could put in the statement which error was displayed.
– stringnome
No error was displayed, Lazarus only generates an error points an error in the lines where I try to do the assignments ex: (code := pcodigo)
– Hércules Moreira