How does c++ help with the tradeoff of security vs.usability, C/C++ Programming

A: In C, encapsulation was completed by making things static in a compilation unit or module. It prevented another module from accessing the static stuff. (Incidentally, now static data at file-scope is deprecated in C++: don't do that.)

Unluckily this approach doesn't support multiple instances of the data, as there is no direct support for making multiple instances of a module's static data. If multiple instances were required in C, programmers typically utilized a struct. But unluckily C structs don't support encapsulation. It exacerbates the tradeoff among safety (information hiding) and usability (multiple instances).

In C++, you can have multiple instances and encapsulation both via a class. The public part of a class has the class's interface, which normally contains the class's public member functions and its friend functions. The private or/ and protected parts of a class have the class's implementation, typically which is where the data lives.

 

The end result is similar to an "encapsulated struct." It decrees the tradeoff between  usability (multiple instances) and safety (information hiding).

!"          !        

 

Posted Date: 3/20/2013 3:40:45 AM | Location : United States







Related Discussions:- How does c++ help with the tradeoff of security vs.usability, Assignment Help, Ask Question on How does c++ help with the tradeoff of security vs.usability, Get Answer, Expert's Help, How does c++ help with the tradeoff of security vs.usability Discussions

Write discussion on How does c++ help with the tradeoff of security vs.usability
Your posts are moderated
Related Questions

Develop libcurl XML project I have a Project using XML with C++. You will use things like LIbcurl etc....and a XML parser to finish the project. Developer must know how to use X

Q-What happens while a function throws an exception which was not specified through an exception specification for this function? A: Unexpected() is called, which, by default, w

Write a Program for Calculating Value of an Integer? For a clear understanding of recursive function we shall see an illustration for calculating value of an integer. main() {

Problem Write a program in C++ to read N numbers in an array, the user should be able to search a particular number in the array using sequential search algorithm. Writing a

Create a C language code, only one program, to implement the following task. Task: Write C code for a program that implements a digital clock (HH:MM:SS). The clock inclu

draw the flow chart to print the fibonacci series upto n th terms

Prepare a program to obtain prime factors of any integer number using functions


how to create program in c that will system restart