You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the problem. What did you see? What did you expect to see?
All fields and functions of structs are public, even those without the public keyword. I would expect that those without the public keyword are private and inaccessible from outside the struct itself.
If this is a code issue, provide a minimal code example:
struct MyStruct {
var privateInt = 3;
function secretFunction() {
printf("~secrets~\n");
}
}
function main() {
var myStruct: MyStruct = struct MyStruct;
myStruct.secretFunction();
printf("%d\n", myStruct.privateInt);
}
Describe the problem. What did you see? What did you expect to see?
All fields and functions of structs are public, even those without the
public
keyword. I would expect that those without thepublic
keyword are private and inaccessible from outside the struct itself.If this is a code issue, provide a minimal code example:
Environment
The text was updated successfully, but these errors were encountered: