Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
I don't think the idea of access modifiers is to be "absolute rules" but more of a guideline in source code for "hidding" some complexity thus providing a cleaner interface.. Of course it is still data saved somewhere on the disk in it's raw, uncrypted format, it would be kind of pointless to crypt and hide private fields in eaxh program, don't you think?
-
Fulton187yI had a hard time grasping the whole private thing as well, my teacher kept saying that you hide certain parts from the programmer implementing your class yet the whole class is visible to everyone.
-
@Fulton Yeah been there. I hope my explanation makes more sense.
Private is something not visible to the outside, because its needed for a core functionality for the class itself. You having direct control over that variable is either pointless or dangerous.
Public is stuff you want to present when talking with other objects, you offer them your functionality and information. Keeping it real and only show stuff important to them.
Protected is stuff you dont want anybody else to have access to really, so you only pass it on to your kids. If they access it it's totally fine but if other objects have access to that, it probably leads to confusion and it's probably very dirty code violating access rules. -
In order to protect your app you need to strip variable names. It will definitly help in cheat engine if you search for name of that var. It wont help if you are looking for changing value :(. You need to encrypt tgat variable then or split it in different memory locations.
Related Rants
-
xjose97x19Just saw a variable in C named like this: long time_ago; //in a galaxy far away I laughed no stop.
-
Unskipp24So this happened last night... Gf: my favorite bra is not fitting me anymore Me: get a new one ? Gf: but it ...
-
sonrisa37Best quotes from IT teacher: - "C# is a language to program your IDE." - "C# is a language for beginners, and...
When I started programming ~5 years ago.
Teacher: OK, C++ classes and structs have 3 access modifiers: private, public and protected.
Private fields can't be accessed out of the current class.
Me thinking: wow, that's cool, but how can it be? I have to research.
I went to home and wrote a class with one variable with its set and get functionality.
Then I opened Cheat engine) and tried to access and change the variable. When I succeeded, I started hating this world of programming.
After some time I understood that it's wonderful cause it's up to you.
rant
school
c++