为什么会报错?解决方法
为什么会报错?
我用的是Lazarus,按照它的help文档中写了一个类的声明,但是编译器却报错,代码如下:
type
MyClass = Class
Private
Field1 : Longint;
Field2 : Longint;
Field3 : Longint;
Procedure Sety(value : Longint);
Function Gety : Longint;
Function Getz : Longint;
Public
Property X : Longint Read Field1 Write Field2;
Property Y : Longint Read GetY Write Sety;
Property Z : Longint Read GetZ;
end;
error message:unit1.pas(32,17) Error: Forward declaration not solved "MyClass.Sety(LongInt);"
unit1.pas(33,16) Error: Forward declaration not solved "MyClass.Gety:LongInt;"
unit1.pas(33,16) Error: Forward declaration not solved "MyClass.Gety:LongInt;"
这是怎么错了?我只在这个类里面作了声明啊!
------解决方案--------------------
Procedure Sety(value : Longint);
Function Gety : Longint;
Function Getz : Longint;
只见声明没见实现部份
我用的是Lazarus,按照它的help文档中写了一个类的声明,但是编译器却报错,代码如下:
type
MyClass = Class
Private
Field1 : Longint;
Field2 : Longint;
Field3 : Longint;
Procedure Sety(value : Longint);
Function Gety : Longint;
Function Getz : Longint;
Public
Property X : Longint Read Field1 Write Field2;
Property Y : Longint Read GetY Write Sety;
Property Z : Longint Read GetZ;
end;
error message:unit1.pas(32,17) Error: Forward declaration not solved "MyClass.Sety(LongInt);"
unit1.pas(33,16) Error: Forward declaration not solved "MyClass.Gety:LongInt;"
unit1.pas(33,16) Error: Forward declaration not solved "MyClass.Gety:LongInt;"
这是怎么错了?我只在这个类里面作了声明啊!
class
------解决方案--------------------
Procedure Sety(value : Longint);
Function Gety : Longint;
Function Getz : Longint;
只见声明没见实现部份