________________________________________________________________________

This file is part of Logtalk <https://logtalk.org/>  
Copyright 1998-2023 Paulo Moura <pmoura@logtalk.org>  
SPDX-License-Identifier: Apache-2.0

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(self_messages(loader)).
...


% the predicate get_local/1 calls the local/1 predicate in "self",
% i.e. in the object that receives the get_local/1 message:

| ?- parent::get_local(Local).

Local = parent
yes

| ?- prototype::get_local(Local).

Local = prototype
yes


% the get_default/1 predicate also calls the default/1 predicate in
% "self" but predicate is only defined in the "parent" object; its
% definition is therefore inherited by the "prototype" object:

| ?- parent::get_default(Default).

Default = parent
yes

| ?- prototype::get_default(Local).

Default = parent
yes


% the get_undefined/1 predicate also calls the undefined/1 predicate in
% "self" but the predicate is only declared and not defined in either
% object making the messages fail as per closed world assumption:

| ?- parent::get_undefined(_).

no

| ?- prototype::get_undefined(_).

no
