Encapsulation question about vJass.

Status
Not open for further replies.
Level 23
Joined
Feb 6, 2014
Messages
2,466
Scenario: I have a library that has structs in it but I want to use that struct in a global block and be private (limited to the library) at the same time, example:
JASS:
library A
    globals
        B something
    endglobals
  
    private struct B
    endstruct
  
endlibrary
^The does not compile because it shouldn't be private struct.
Is it possible? I assume Vexorian made it possible.
 

Chaosy

Tutorial Reviewer
Level 40
Joined
Jun 9, 2011
Messages
13,207
I tried a few things myself, none worked.
This was one thing I tried but it did not work, sadly.
JASS:
library A
    private struct B
		public static B something
    endstruct
endlibrary

library X
	function onInit takes nothing returns nothing
		set something = 1
	endfunction
endlibrary

The only thing I can come up with would be to do it the other way around. Basically making the struct public, but making every method/variable private.
 
Status
Not open for further replies.
Top