Examples
Logtalk's syntax is based on Prolog:
?- write('Hello world'), nl. Hello world true.Defining an object:
:- object(my_first_object). :- public(p1/0). p1 :- write('This is a public predicate'), nl. :- private(p2/0). p2 :- write('This is a private predicate'), nl. :- end_object.Using the object:
?- my_first_object::p1. This is a public predicate true.Trying to access the private predicate gives an error:
?- my_first_object::p2. ERROR: error(permission_error(access, private_predicate, p2), my_first_object::p2, user)Read more about this topic: Logtalk
Famous quotes containing the word examples:
“It is hardly to be believed how spiritual reflections when mixed with a little physics can hold peoples attention and give them a livelier idea of God than do the often ill-applied examples of his wrath.”
—G.C. (Georg Christoph)
“Histories are more full of examples of the fidelity of dogs than of friends.”
—Alexander Pope (16881744)
“In the examples that I here bring in of what I have [read], heard, done or said, I have refrained from daring to alter even the smallest and most indifferent circumstances. My conscience falsifies not an iota; for my knowledge I cannot answer.”
—Michel de Montaigne (15331592)