为什么我自己写的class不能用。(50分)

B

Boblee

Unregistered / Unconfirmed
GUEST, unregistred user!
我是dephi新手,dephi是OOP的。我就用这个写一自己用的程序。但我自己写的class怎么也不
用,出错的地方在constructor create上。总是提示访问内存地址错误。以下是我写的class
.一个用的,一个就是这个class.
useclass.pas:
...
uses
...,panoObj;
procedure ....()
var
ascene:TScene;
begin
ascene.create
<------ error here
...
end;
...

panoObj.pas <-- myself class
unit panoObj;

interface

uses
Windows;

type

TScene = class
private
name:string;
path:string;
procedure setPicName(aName:string);
procedure setPicPath(aPath:string);

function getPicName:string;
function getPicPath:string;

public
constructor Create;overload;

property PicName:string read GetPicName write SetPicName;
property PicPath:string read GetPicPath write SetPicPath;
end;

THotSpot = class
private
//ahotspot:TObject;
name:string;
procedure setName(aName:string);
function getName:string;
public
constructor Create;overload


property HotSpotName:string read GetName write SetName;
end;


implementation


procedure TScene.setPicName(aName:string);
begin
name:=aName;
end;

function TScene.getPicName():string
begin
getPicName:=name;
end;

function TScene.getPicPath():string
begin
getPicPath:=path;
end;

procedure TScene.setPicPath(aPath:string);
begin
path:=aPath;
end;

procedure THotSpot.setName(aName:string);
begin
name:=aName;
end;

function THotSpot.getName():string
begin
getName:=name;
end;


constructor TScene.Create
<-- 对我的class而言,我不知这儿应放什么。
begin
//
end

constructor THotSpot.create;
begin
//
end;
end.

编绎也能运行,就是一到构造器就出错,帮忙。:*(

 
>>ascene.create
<------ error here
--> ascene:=TScene.Create;
 
收到。[:D]
给分啦。。。。
 

Similar threads

I
回复
0
查看
550
import
I
I
回复
0
查看
599
import
I
I
回复
0
查看
634
import
I
I
回复
0
查看
568
import
I
I
回复
0
查看
524
import
I
顶部