what is difference between shadows and private?
plz anyone can tell me with example?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Jaish MathewsPosted Jul 26, 2010, 2:47 PM
We can't differentiate both as both are different concepts. I think you know what meant by "private". It's using for simply to restrict access from out side world.
Now shadowing. It's basically VB.NET key word. It's equivalent in C# is hiding and in C# it's implementing using key word "new". Shadowing or hiding feels like overriding, but difference is there.
The shadow keyword allows you to hide a base implementation in an inheritance
hiearcy. This is useful in situations, such as a base class change declaring
a method already defined in your derived class. Redifining access levels, or
the readability/writeability of a property
Check here for some difference between shadowing/hiding and overriding
http://www.c-sharpcorner.com/UploadFile/jaishmathews/DifferentiateHidingandOverriding02252006123905PM/DifferentiateHidingandOverriding.aspx?ArticleID=ea4ba754-8b02-4bde-8f96-a90b428d3656