Give a new instance an different name than the name of the class which creates the instance. This operator can only be used while creating a new instance with the operators new_obj/2 or new_obja/2.
see also: new_obj/2 new_obja/2 object-oriented prolog
| Examples | |
| X new_obj stack obj_name mystack. | new instance of the class 'stack' is created that is called 'mystack' |
| X new_obja menu obj_name file_menu. | a new menu instance was created with the name 'file_menu' |
| Exceptions | |
| an operator other than 'obj_name' is used | a type_error(evaluable, A) exception is thrown and A is replaced by the incorrect operator |
| right operand of 'obj_name' is an empty variable | an instantiation_error exception is thrown |
| right operand of 'obj_name' is not an atom nor a variable containing an atom | a type_error(atom, A) exception is thrown, A is replaced by the value of the incorrect operand |