________________________________________________________________________

This file is part of Logtalk <https://logtalk.org/>  
Copyright 1998-2019 Paulo Moura <pmoura@logtalk.org>

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
________________________________________________________________________


% start by loading the example:

| ?- logtalk_load(instvars(loader)).
...


% get the value of the instance variable for each instance (the default value,
% stored in the instances class, is returned):

| ?- instance1::ivar(Value1), instance2::ivar(Value2), instance3::ivar(Value3).

Value1 = 0
Value2 = 0
Value3 = 0
yes


% change the value of the instance variable for instance1:

| ?- instance1::set_ivar(1).

yes


% get the value of the instance variable for each instance:

| ?- instance1::ivar(Value1), instance2::ivar(Value2), instance3::ivar(Value3).

Value1 = 1
Value2 = 0
Value3 = 0
yes
