Property and Encapsulation

Posted by Lijo on Stack Overflow See other posts from Stack Overflow or by Lijo
Published on 2010-05-25T09:24:07Z Indexed on 2010/05/25 10:51 UTC
Read the original article Hit count: 124

Filed under:

Hi Team,

Following is a question regarding using Properties in class.

I am software engineer with 3 years of experience. I have been using public properties instead of exposing member variables publically. Many a people told that this approach helps in encapsulation. I don’t realize any encapsulation advantage by making it a property.

While discussions, I came to know that not many people knows about the real reason for going for Property. They just do it as part of coding standard.

Can someone clearly explain how Property is better than public member variable? How it improves encapsulation?

Thanks

Lijo

© Stack Overflow or respective owner

Related posts about oop