?
Solved

Errors ''[Error] Calculadora.pas(58): Declaration of 'Numero' differs from previous declaration"

Posted on 2003-02-22
2
Medium Priority
?
288 Views
Last Modified: 2008-02-01
I have the following:
unit Calculadora;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TFrmCalc = class(TForm)
    Uno: TButton;
    Dos: TButton;
    Tres: TButton;
    Cuatro: TButton;
    Cinco: TButton;
    seis: TButton;
    Siete: TButton;
    Ocho: TButton;
    Nueve: TButton;
    Cero: TButton;
    Punto: TButton;
    Igual: TButton;
    Sumar: TButton;
    Restar: TButton;
    Multipicar: TButton;
    Dividir: TButton;
    Ce: TButton;
    Display: TMemo;
    procedure FormCreate(Sender: TObject);
    procedure UnoClick(Sender: TObject);
    procedure Numero(Display: TObject; num:char; var flag:Boolean);
  private
    //Declaraciones Privadas
  public

  end;

var
  FrmCalc: TFrmCalc;
  Nume1: Real;
  Operador: Char;
  EFlagcons: Boolean;
  Resultado: Variant;
  ERes: Real;
  Flagpor: Boolean;
  EFlagpunto: Boolean;
  Flagop: Boolean;

implementation

{$R *.dfm}

procedure TFrmCalc.FormCreate(Sender: TObject);
begin
display.Text:='0'; {Cadena 0 para el display}
end;
*********************************************************
procedure TFrmCalc.Numero (Display: Tmemo; num:char; var flag:Boolean);
*********************************************************
begin
if (display.text = '0') then {verifica el '0'}
  display.text:=num
else
begin
  if flag=true then {flag indica si esta en alguna operacion}
  begin
  display.text:=num;
  flag:=false
end
else
  display.text:=display.text+num;
  end
end;

procedure TFrmCalc.UnoClick(Sender: TObject);
begin
Numero (Display, '1' ,flagop)
end;

end.


The line wich is in '********' gives the following errors:

[Error] Calculadora.pas(58): Declaration of 'Numero' differs from previous declaration
[Error] Calculadora.pas(60): Undeclared identifier: 'text'
[Error] Calculadora.pas(61): Undeclared identifier: 'text'
[Error] Calculadora.pas(66): Undeclared identifier: 'text'
[Error] Calculadora.pas(70): Undeclared identifier: 'text'
[Error] Calculadora.pas(70): Undeclared identifier: 'text'
[Fatal Error] calc.dpr(5): Could not compile used unit 'Calculadora.pas'

...So, what can I do?
0
Comment
Question by:diossito
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 7

Accepted Solution

by:
billious earned 75 total points
ID: 8001688
In TFrmCalc type-declaration you have

procedure Numero(Display: TObject; num:char; var flag:Boolean);

and you then declare the procedure with
procedure TFrmCalc.Numero (Display: Tmemo; num:char; var flag:Boolean);

Since Tmemo <> Tobject, the compiler doesn't like it.

Change Tobject in the type declaration to Tmemo - should fix up the 'text' problems, too!

...Bill


0
 

Author Comment

by:diossito
ID: 8001813
Thanks for help me, there is what it's yours
0

Featured Post

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The purpose of this article is to demonstrate how we can use conditional statements using Python.
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question