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 

How Can I Make an Assoctated Object Read-Only Really?

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





PostPosted: Sun Jan 07, 2007 10:43 am    Post subject: How Can I Make an Assoctated Object Read-Only Really? Reply with quote



I Have Designed 2 Interface in My Application: Bus & Driver. There is
an Associated Object(Interface) IBus in IDriver, Such as Below:


IBus = interface
{TGUID}
function GetCode: string;
procedure SetCode(const Value: string);
function GetBrand: string;
procedure SetBrand(const Value: string);
......
property Code: string read GetCode write SetCode;
property Brand: string read GetBrand write SetCode;
......
end;


IDriver = interface
{TGUID}
function GetID: string;
procedure SetID(const Value: string);
function GetName: string;
procedure SetName(const Value: string);
......
functuon GetBus: IBus;
property ID: string read GetID write SetID;
property Name: string read GetName write SetName;
......
property Bus: IBus read GetBus;
end;

TBus = class(TInterfacedObjec, IBus)
.....
end;

TDriver = class(TInterfacedObjec, IDriver)
.....
end;


When I Load Bus From Driver, I Can't Make Driver.Bus Read-only Really.
as I can write Bus.Code/Bus.Brand ALSO.

Driver.Bus.Code := 'xxxxxx';
Driver.Bus.Brand := 'xxxxxx';

Maybe I Should Hide THE BUS Back From Driver, Just Add IBus's Fields
into IDriver as Below:

IDriver = interface
{TGUID}
function GetID: string;
procedure SetID(const Value: string);
function GetName: string;
procedure SetName(const Value: string);
......
function GetCode: string;
function GetBrand: string;

property ID: string read GetID write SetID;
property Name: string read GetName write SetName;
......
property Code: string read GetCode;
property Brand: string read GetBrand;
end;


But I Don't Like This Way.

Is there a solution to meet my needing?
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.