Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


How can I prevent other programmers from violating
encapsulation by seeing the private parts of my class?



How can I prevent other programmers from violating encapsulation by seeing the private parts of my ..

Answer / abalonesoft

Not worth the effort — encapsulation is for code, not people.

It doesn't violate encapsulation for a programmer to see the
private and/or protected parts of your class, so long as
they don't write code that somehow depends on what they saw.
In other words, encapsulation doesn't prevent people from
knowing about the inside of a class; it prevents the code
they write from becoming dependent on the insides of the
class. Your company doesn't have to pay a "maintenance cost"
to maintain the gray matter between your ears; but it does
have to pay a maintenance cost to maintain the code that
comes out of your finger tips. What you know as a person
doesn't increase maintenance cost, provided the code you
write depends on the interface rather than the implementation.

Besides, this is rarely if ever a problem. I don't know any
programmers who have intentionally tried to access the
private parts of a class. "My recommendation in such cases
would be to change the programmer, not the code" [James
Kanze; used with permission].

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C Interview Questions

What is meaning of tree

0 Answers  


What is LINKED LIST? How can you access the last element in a linked list?

0 Answers   ADP,


What is equivalent to ++i+++j?

0 Answers  


.main() { char *p = "hello world!"; p[0] = 'H'; printf("%s",p); }

0 Answers   Wilco,


what is foreign key in c language?

1 Answers   ADP,


what is the stackpointer

2 Answers  


What is the c value paradox and how is it explained?

0 Answers  


How pointer is benefit for design a data structure algorithm?

2 Answers  


How can you dynamically allocate memory in C?

2 Answers  


mplementation of stack using any programing language

1 Answers   Marlabs,


Tell us two differences between new () and malloc ()?

0 Answers   Adobe,


What is character set?

0 Answers  


Categories