protected/1 — Logtalk 3.100.1

directive

# `protected/1`

## Description

    protected(Name/Arity)
    protected((Name/Arity, ...))
    protected([Name/Arity, ...])

    protected(Name//Arity)
    protected((Name//Arity, ...))
    protected([Name//Arity, ...])

    protected(op(Precedence,Associativity,Operator))
    protected((op(Precedence,Associativity,Operator), ...))
    protected([op(Precedence,Associativity,Operator), ...])

Declares protected predicates, protected grammar rule non-terminals, and protected operators. A protected predicate can only be called from the object containing the directive or from an object that inherits the directive. A protected non-terminal can only be used as an argument in a phrase/2 and phrase/3 calls from the object containing the directive or from an object that inherits the directive.

Note

Protected operators are not inherited but declaring them provides a reusable specification for using them in descendant objects (or categories).

## Template and modes

    protected(+predicate_indicator_term)
    protected(+non_terminal_indicator_term)
    protected(+operator_declaration)

## Examples

    :- protected(init/1).

    :- protected((print/2, convert/4)).

    :- protected([load/1, save/3]).

See also

private/1, public/1, predicate_property/2