Page 1 of 1
Instance var with READONLY attribute
Posted: Thu Nov 30, 2006 10:05 pm
by James Bott
Perhaps this is a xHarbour question, but if I create an instance variable with the READONLY attribute, shouldn't it be protected from having an assignment. xHarbour is allowing me to assign data directly to a READONLY variable. I think it should be generating an error.
I am using the Sept 2006 version of FWH/xHarbour.
James
#include "fivewin.ch"
function main()
local oObj:= TTest():new()
oObj:cVar := "Test readonly"
msgInfo( oObj:cVar ) // returns "Test readonly"
return nil
class TTest
data cVar READONLY
method new()
endclass
method new() class TTest
return self
// eof
Re: Instance var with READONLY attribute
Posted: Fri Dec 01, 2006 8:31 am
by Enrico Maria Giordano
As I already answered on xHarbour newsgroup, the access modifiers have no effect at the module level.
EMG
Posted: Fri Dec 01, 2006 9:11 am
by James Bott
Enrico,
>As I already answered on xHarbour newsgroup, the access modifiers have no effect at the module level.
I'm sorry I'm not sure what you are saying. Do you mean if the program and the class are in the same PRG?
Did you answer my question on the xHarbour newsgroup? I tried to post the same question there, but it never showed up. I still don't see it.
James
Posted: Fri Dec 01, 2006 9:22 am
by Enrico Maria Giordano
James Bott wrote:Enrico,
>As I already answered on xHarbour newsgroup, the access modifiers have no effect at the module level.
I'm sorry I'm not sure what you are saying. Do you mean if the program and the class are in the same PRG?
Exactly.
James Bott wrote:Did you answer my question on the xHarbour newsgroup? I tried to post the same question there, but it never showed up. I still don't see it.
James
From the xHarbour newsgroup:
EMG
Posted: Fri Dec 01, 2006 8:32 pm
by James Bott
Thanks Enrico. How very strange that I cannot see either my message or your reply in the xHarbour newsgroup. I just checked it again this morning and I still can't see it. I do have 4 blocked senders for newsgroups but neither you or I are among them. I have never had this happen before.
James