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
Hi is there any chance to get assignment for fresher tutor

How does free know the size of memory to be deleted.? int *i = (int *)malloc(12); followed by free(i); how did free function call know how much of memory to delete? A: It bas

write c program to do the following : -fill 2 dimensional array (square matrix array with size=4). -ask the user to enter any integer number and add this number to the diagonals -o

write a programme that computes the price of shares and options. do the options in one-period binomial model.

Write a C program to input 16 numbers and print them out in a table format of 4 wide by 4 deep. E.g.   4    5    5    7   8    9    10    11   12    13    14    15   16    17

how c program starts executing?

Need FTP Upload and MySQL Project Description: We are in need of an executable application that will be execute as a scheduled task on Windows Server 2008 R2 and can perform

Ask questionByteland county is very famous for luminous jewels. Luminous jewels are used in making beautiful necklaces. A necklace consists of various luminous jewels of particular

Program of swapping two varibales: void swap(int *, int *);   // This is swap's prototype int main() {                 int x = 5, y = 7;                 swap(&x, &

Smugglers are becoming very smart day by day. Now they have developed a new technique of sending their messages from one smuggler to another. In their new technology, they are send