Did you know ... Search Documentation:
Pack logtalk -- logtalk-3.77.0/examples/inheritance/SCRIPT.txt

This file is part of Logtalk https://logtalk.org/ SPDX-FileCopyrightText: 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(inheritance(loader)). ...

% parent interface

| ?- parent::interface.

public/0 - public protected/0 - protected private/0 - private

yes

% prototype1 extends public::parent

| ?- prototype1::interface.

public/0 - public protected/0 - protected

yes

% prototype2 extends protected::parent

| ?- prototype2::interface.

public/0 - protected protected/0 - protected

yes

% prototype3 extends private::parent

| ?- prototype3::interface.

public/0 - private protected/0 - private

yes

% descendant1 extends public::prototype1

| ?- descendant1::interface.

public/0 - public protected/0 - protected

yes

% descendant2 extends public::prototype2

| ?- descendant2::interface.

public/0 - protected protected/0 - protected

yes

% descendant3 extends public::prototype3

| ?- descendant3::interface.

yes

% object (root of the inheritance graph) interface

| ?- root::interface.

public/0 - public protected/0 - protected private/0 - private

yes

% instance1 instantiates subclass1 that specializes public::root

| ?- instance1::interface.

protected/0 - protected public/0 - public yes

% instance2 instantiates subclass2 that specializes protected::root

| ?- instance2::interface.

protected/0 - protected public/0 - protected yes

% instance3 instantiates subclass3 that specializes private::root

| ?- instance3::interface.

yes