Hi Bill,

Thanks for the update.

But why the reference mechanism is like this? In case of OO Languages like
C++ or Java, for every instance a new memory area has been allocated in the
heap memory and the value is maintained specific to the instance.

Why this differs in the case of Cach� even it follows the OO principles. Are
the values are referred as static reference?

I am sorry for bothering again.

Thanks
-Balaji



"Bill McCormick" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> You can never have more then one "copy" of the same object instance open
> in memory. If you opened ID 1 and ID 2 you can edit them both as much as
> you like. But reopening 1 while the original pointer is still in memory
> just creates a second reference to the in memory object.
>
> Balaji.R wrote:
> > Hi All,
> >
> > I am perplexed about the strategy of handling the objects in Cach�.
> >
> > Let me explain my question with an example.
> >
> > set objEmp1=##class(Employee.EmpDetails).%OpenId(1)
> > Write !,objEmp1.MiddleInitial
> > Output: T
> >
> > set objEmp1.MiddleInitial="A"
> > Write !,objEmp1.MiddleInitial
> > Output: A
> >
> > without saving this instance, I tried to create another instance for
this
> > class and ID.
> >
> > set objEmp2=##class(Employee.EmpDetails).%OpenId(1)
> > Write !,objEmp2.MiddleInitial
> > Output: A
> >
> > My question is,
> >
> > When I tried to change the MiddleInitial using the first instance
objEmp1, I
> > could find the MiddleInitial updated with 'A' for the instance objEmp1.
But
> > without saving or killing the instance objEmp1, when I tried to create
> > another instance of the same class and ID say objEmp2, and output the
> > MiddleInitial value, the value which was set for objEmp1 was displayed
for
> > objEmp2's property also.
> >
> > How could the multiple instances share the same value without any
> > updation/saving made to the prior instance ? How the values are handled
for
> > the instances?
> >
> > Kindly Clarify. FYI, I am using Cach� 5.0
> >
> > Thanks in Advance.
> >
> > -Balaji
> >
> >



Reply via email to