I've played around with this a little more and came up with this:
forward
global type n_baseobject from nonvisualobject
end type
end forward
global type n_baseobject from nonvisualobject
end type
global n_baseobject n_baseobject
type variables
private:
long il_private
end variables
forward prototypes
public subroutine of_test ()
private subroutine of_manipulate (n_baseobject anv_external, long al_value)
private subroutine of_private (long al_value)
end prototypes
public subroutine of_test ();//
// testing local access
//
n_baseobject lnv_base
lnv_base = create n_baseobject
//compiles
lnv_base.il_private = 4
lnv_base.of_private( 5 )
//let's go crazy
lnv_base.of_manipulate( this, 667 )
end subroutine
private subroutine of_manipulate (n_baseobject anv_external, long al_value);//
// external
//
anv_external.il_private = al_value
end subroutine
private subroutine of_private (long al_value);//
// private subroutine
//
il_private = al_value
end subroutine
on n_baseobject.create
call super::create
TriggerEvent( this, "constructor" )
end on
on n_baseobject.destroy
TriggerEvent( this, "destructor" )
call super::destroy
end on
Note the line
lnv_base.of_manipulate( this, 667 )
in particular, which calls a private subroutine of a locally created instance of n_baseobject, which in turn changes the private instance variable il_private of the calling instance of n_baseobject that was given as an argument to the method.
Still not sure if this is "bad" per se but it certainly feels utterly wrong to be able to do this, as contrived as this example may be.
Well, you never stop learning.
Really the idea with private variables and functions is not so much run-time data protection but rather with compile time coding protection. By allowing a private variable to be accessed only from within the scope of the class in which it has been declared, its use is limited to whatever programmer is working on the class in question. So if you write the n_object class, you know how it functions, how its inner workings function, and can be trusted to use the il_private variable correctly in a way that some other programmer who simply uses the n_object class and may not really understand the use of il_private cannot. And if you ever need to change n_object and il_private, maybe change it to a double datatype, because it is private, you know that the only source code that needs to be considered is that of n_object.