#need some guidance on syntax/logic

1 messages · Page 1 of 1 (latest)

dusky fossil
#

So i have created a card game which has an admin class that has some private methods just for the admin. So the switch there is an menu of options and basically i wanna use the private method but i cant. Need some guidance on this

sinful arrowBOT
#

<@&987246841693360200> please have a look, thanks.

sinful arrowBOT
#

While you are waiting for getting help, here are some tips to improve your experience:

Code is much easier to read if posted with syntax highlighting and proper formatting.

If nobody is calling back, that usually means that your question was not well asked and hence nobody feels confident enough answering. Try to use your time to elaborate, provide details, context, more code, examples and maybe some screenshots. With enough info, someone knows the answer for sure.

Don't forget to close your thread using the command </help-thread close:1027500463647621170> when your question has been answered, thanks.

shadow shadow
#

@dusky fossil You can make them public or package-private methods

#

if you wanted to do something like "must have admin auth to call method, enforced by type system"

#

then thats doable, but not exactly useful

#

but if you want to do it then like

dusky fossil
#

but by making them public wont make them like vulnerable in a sense? although its just a simple game but

#

still a bad practice i guess?

shadow shadow
#

well, your mechanisms here are public/private/package-private

#

and the module system

#

so you can prevent code in other packages from accessing code in a package

#

or you can group your packages into a module and make sure other modules can't access some of the packages

#

other kinds of auth are a layer on top of that, but they aren't code-level security

#

still a bad practice i guess
Eh? your code is not more than 1000 lines

#

and this is something large codebases can get away without doing

#

proper modularization isn't exactly for this

dusky fossil
#

i see, will try to do so