アプリ版:「スタンプのみでお礼する」機能のリリースについて

//Base.pas
TSituation = class(TObject)
public
 procedure Update;virtual;abstract;
 procedure Reflect;virtual;abstract;
end;

//Title.pas
TSceneTitle = class(TSituation)
private
 ・
 ・
 ・
public
 constructor Create;
 destructor Destroy;override;
 procedure Update;override;
 procedure Reflect;override;
end;

//main.pas(メインフォーム)
unit main;
interface
uses
 ・・・, Base, Title;
   ・
   ・
   ・
var
 fm_main: Tfm_main;
 Situation: TSituation;
---------------------------------------------------
こう、きちんとクラスの宣言も継承もしているのに、(しているはず
Situation := TSceneTitle.Create;
とすると互換性がないといってコンパイルエラーになります。
なにかおかしいところがあるのでしょうか。

A 回答 (1件)

簡単のため下のコードのように一つのunitで試したところ、コンパイル、実行できました。

unitの参照の問題かもしれません。

Windows XP Pro SP3 + Delphi7 Pro 及び Vista Ultimate SP1 + Delphi2009 Proで試しました。

unit Unit1;
interface
uses
 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
 Dialogs;
type
 TForm1 = class(TForm)
  procedure FormCreate(Sender: TObject);
 private
 public
 end;
//Base.pas
TSituation = class(TObject)
public
 procedure Update;virtual;abstract;
 procedure Reflect;virtual;abstract;
end;
//Title.pas
TSceneTitle = class(TSituation)
private
public
 constructor Create;
 destructor Destroy;override;
 procedure Update;override;
 procedure Reflect;override;
end;
var
 Form1: TForm1;
 Situation: TSituation;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
 Situation := TSceneTitle.Create;
end;
Constructor TSceneTitle.Create;
begin
 ShowMessage('TSceneTitle.Create');
end;
destructor TSceneTitle.Destroy;
begin
end;
procedure TSceneTitle.Update;
begin
end;
procedure TSceneTitle.Reflect;
begin
end;
end.

この回答への補足

書き忘れましたが、Delphi6Personal使用です。

>一つのunitで
それなりの大きさのゲームに挑戦中なので、
ちょっと無理が・・・^^;

コード補完機能はちゃんと働くし、(←画像)http://imagepot.net/view/123087053878.jpg
コンパイルエラーにも出ないのでユニットの循環参照なんかは
起こってないかと思いますが・・・

補足日時:2009/01/02 13:18
    • good
    • 0
この回答へのお礼

自己解決しました。
わざわざテストまでして頂いてありがとうございました。

最初にBace.pasをつくり、途中でスペルにきづいてBase.pasに
変更した際、Bace.dcuが残ったままだったようです。

お礼日時:2009/01/02 14:49

お探しのQ&Aが見つからない時は、教えて!gooで質問しましょう!