>>>   Under Delphi 5 I get an error stating that the "Declaration of Assign
>>> differs from previous declaration", I also get the same problem for the
>>> function "Equals"
>>>   TInternal = object
>>>     m_type : DATA_OBJECT_TYPES;         // What context is the data object.
>>>     m_cookie : LongInt;                 // What object the cookie represents
>>>     m_string : string;                  //
>>>     m_clsid : TGuid;                  // Class ID of who created this data
>>>     constructor Create;
>>>     procedure Assign (const Another : TInternal);
>>>     function Equals (const Another : TInternal) : boolean;
>>>   end;
>>>   PInternal = ^TInternal;

>> Is TInternal inheriting from anyother object or is this pasted code...
>> Anything that inherits from tpersistent would get a warning that your
>> declaration of Assign hides the declaration on TPersistent.

> There should not be anything like that Aaron, the code I pasted is from the
> source file.

[Smacks forehead]

Doh...

The declaration is of course not creating a class from TObject since it says 
TInternal=object.
I haven't used these old style objects but I did note that a number of the D5 bug 
reports point
to handling of these old object becoming less supported.  It would be adviseable to 
write all code
as descended from TObject in the newer Class declaration type...

This should compile fine... Assuming various other type declarations are available (IE 
DATA_OBJECT_TYPES)...

TInternal = class(TObject)
public
  m_type : DATA_OBJECT_TYPES;   // What context is the data object.
  m_cookie : LongInt; // What object the cookie represents
  m_string : string;     //
  m_clsid : TGuid;      // Class ID of who created this data
  constructor Create;
  procedure Assign (const Another : TInternal);
  function Equals (const Another : TInternal) : boolean;
end;

procedure TInternal.Assign (const Another : TInternal);
begin
  m_type := Another.m_type;
  m_cookie := Another.m_cookie;
  m_string := Another.m_string;
  Move (Another.m_clsid, m_clsid, sizeof (m_clsid));
end;

function TInternal.Equals (const Another : TInternal) : boolean;
begin
   result := m_string = Another.m_string;
end;

--
Aaron Scott-Boddendijk
Jump Productions
(07) 838-3371 Voice
(07) 838-3372 Fax


---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz

Reply via email to