BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Interfaces again: GetItem differs from declaration in interf

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi OO design
View previous topic :: View next topic  
Author Message
Andrea Raimondi
Guest





PostPosted: Mon Dec 27, 2004 11:58 am    Post subject: Interfaces again: GetItem differs from declaration in interf Reply with quote



Hey Peers,

It seems I'm missing something trivial here.
The IList implementation compiles fine, but IAttributeList one isn't
willing to work whatever I'm doing.

This is my IList implementation interface(compiles fine):

TConcreteList = class( TInterfacedObject, IList )
private
FIntfList : TInterfaceList;
protected
procedure AddItem(AnItem: IListItem);overload;virtual;
procedure AddItem( AStream : TStream );overload;virtual;abstract;
procedure AddItem( AString : String );overload;virtual;abstract;

function GetAsString: String;virtual;abstract;
function GetCount: Integer;
function GetIListItem(Index: Integer): IListItem;
// Method resolution for IList
function IList.GetItem = GetIListItem;
public
procedure AfterConstruction;override;
destructor Destroy;override;
end;

The basic idea is that I'll manage my interface list with TInterfaceList
class.

Now, I have this class which implements an attribute list:

TAttributeList = class( TConcreteList, IList, IAttributeList )
protected
procedure AddItem(AnItem: IAttribute);overload;
procedure AddItem( AStream : TStream );overload;override;
procedure AddItem( AString : String );overload;override;
function GetAsString: String;override;
function GetItem(Index: Integer): IAttribute;
end;

Compiler complains about the error message in subject. I think I'm
missing something very very basic but I've no clue what.

Any help?

TIA,

Andrew
--
Online thoughts blog
http://araimondi.blogspot.com
Back to top
Joanna Carter (TeamB)
Guest





PostPosted: Mon Dec 27, 2004 12:06 pm    Post subject: Re: Interfaces again: GetItem differs from declaration in in Reply with quote



"Andrea Raimondi" <rainaple (AT) tin (DOT) it> a écrit dans le message de news:
41cff78b$1 (AT) newsgroups (DOT) borland.com...

Quote:
TAttributeList = class( TConcreteList, IList, IAttributeList )
protected
procedure AddItem(AnItem: IAttribute);overload;
procedure AddItem( AStream : TStream );overload;override;
procedure AddItem( AString : String );overload;override;
function GetAsString: String;override;
function GetItem(Index: Integer): IAttribute;
end;

Compiler complains about the error message in subject. I think I'm
missing something very very basic but I've no clue what.

Yes, don't include IList in the declaration of TAttributeList and also you
may have to mark both the base and derived GetItem methods as overload.

Joanna

--
Joanna Carter (TeamB)

Consultant Software Engineer
TeamBUG support for UK-BUG
TeamMM support for ModelMaker



Back to top
Andrea Raimondi
Guest





PostPosted: Mon Dec 27, 2004 1:55 pm    Post subject: Re: Interfaces again: GetItem differs from declaration in in Reply with quote



Joanna Carter (TeamB) wrote:
Quote:
Yes, don't include IList in the declaration of TAttributeList and also you
may have to mark both the base and derived GetItem methods as overload.

This is the new declaration:

TAttributeList = class( TConcreteList, IAttributeList )
private
function GetItem(Index: Integer): IAttribute;
protected
procedure AddItem(AnItem: IAttribute);overload;
procedure AddItem( AStream : TStream );overload;override;
procedure AddItem( AString : String );overload;override;
function GetAsString: String;override;
function GetAttributeItem(Index: Integer): IAttribute;
function IAttributeList.GetItem = GetAttributeItem;
end;

It only shows the same error, but it seems correct to me.

Anything I may be doing wrong?

Cheers,

Quote:
Joanna

Andrew
--
Online thoughts blog
http://araimondi.blogspot.com

Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi OO design All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.