ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
Do you have a collection of Interview Questions and interested to share with us!!
Please send that collection to along with your userid / name. ThanQ
Google
 
Categories  >>  Software  >>  Programming Languages  >>  C
 
 


 

 
 C interview questions  C Interview Questions
 C++ interview questions  C++ Interview Questions
 VC++ interview questions  VC++ Interview Questions
 Delphi interview questions  Delphi Interview Questions
 Programming Languages AllOther interview questions  Programming Languages AllOther Interview Questions
Question
How can I prevent other programmers from violating
encapsulation by seeing the private parts of my class?
 Question Submitted By :: Abalonesoft
I also faced this Question!!     Rank Answer Posted By  
 
  Re: How can I prevent other programmers from violating encapsulation by seeing the private parts of my class?
Answer
# 1
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
Abalonesoft
[Abalonesoft Technologies]
 

 
 
 
Other C Interview Questions
 
  Question Asked @ Answers
 
what is the difference between arrays and linked list Tech-Mahindra15
What are volatile variables?  1
what is difference between array of characters and string Accenture10
what are the general concepts of c and c++  1
WHY DO WE USE A TERMINATOR IN C LANGUAGE?  2
please give me some tips for the selection in TCS. TCS3
How can draw a box in cprogram without using graphics.h header file & using only one printf(); ? NIIT1
What is a class?  2
what is the output for the code : main() { int i,j; printf("%d %d ",scanf("%d%d",&i,&j)); } Infosys14
WHAT IS THE DIFFERANCE BITWIN GETS();AND SCANF();  2
which one is not preprocessor directive a)#if b)#elif c)#undef d)#pragma Wipro13
how to convert binary to decimal and decimal to binary in C lanaguage  4
I have a function which accepts, and is supposed to initialize,a pointer, but the pointer in the caller remains unchanged.  1
how to find the kth smallest element in the given list of array elemnts. Silicon5
#include<stdio.h> int fun(); int i; int main() { while(i) { fun(); main(); } printf("hello \n"); return 0; } int fun() { printf("hi"); } answer is hello.how??wat is tat while(i) mean? Intel4
what is output of the following statetment?Printf(“%x”, -1<<4); ?  3
How do I declare a pointer to an array?  5
how can i get this by using for loop? * ** * **** * ****** Excel3
what is the defrenece between structure and union  5
pointer_variable=(typecasting datatype*)malloc(sizeof(datatype)); This is the syntax for malloc?Please explain this,how it work with an example? Excel2
 
For more C Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com