Why do you talk so much about security in targeted programming? [closed]

0

I program in C and now I decided to break into the world of OOP by C # language. I see that many people talk about security and that's just my doubt, when programming I see that the development environment itself limits my access to private classes as well as their attributes and methods. When I define this class as public everything that belongs to it is accessible within other classes.

1 ° Define as private a class protects the programmer's code or the user's application?

2 ° If I access attributes and methods of a class A in a class B, am I jeopardizing application security?

If someone can also give me some tips related to the organization of the code, I'll be grateful because I'm used to C so I always modularize my code separated by 2 headers (functions and libraries) and 1 .c where I call all functions. Since in C # it has the advent of classes and security:

3 ° What would be the best way to organize everything in different scripts securely?

    
asked by anonymous 20.12.2016 / 15:40

1 answer

3

Security is a property that has nothing to do with object-oriented programming. Maybe the term was different.

Setting something as private does not protect anything. What is done is that the compiler does not let you use normal code that calls that member. Nothing prevents the member from being accessed by non-normal forms, such as reflection . It does not even protect an instance access private members from another instance of the same class.

This annotation on the member is only an indication of what you should not do. This has to do with encapsulation, with concealment of unnecessary information to the code. But do not conceal concealment with protection. It's just that it's in a wrapper, if you want to open it, it's all there to see.

Accessing members of a class does not compromise any security. If that happened or could not do something.

It is possible to use private classes, but almost never they are useful, a private class can only be accessed inside another class where it has been declared.

C # may even be used like this, but it is not a script language.

It is difficult to answer the other questions. I suggest asking more specific questions and more details.

I also suggest looking for a structured way to learn these concepts, perhaps a good book.

    
20.12.2016 / 15:52