c# basics training (inheritance)
DESCRIPTION
Our C# basics training slides, which we used in out recent training batchTRANSCRIPT
Coding HorrorThe scary show for Programmers
Based on True stories from the desk of software
programmers
InheritanceEpisode #1
About the dumbledores
Syed Mansoor Ahmed
(Project Manager)- Proud Wiproite from
last 10 Yrs- Leads AppC
Automation team
Ankit Kashyap(Analyst Programmer)
- Proud Wiproite from last 5.9 Yrs
- Works as developer; take care of AppC tools
Why We need it?
Code Reuse!!
Polymorphism
Many more…
Open Close Principle
“software entities (classes, modules, functions, etc.) should be open for extension,
but closed for modification”-from Wikipedia
We all know Inheritance! Yay!!
Let’s check it!!!
Time for hands-on…
Car is a vehicle! So
sweet!!
Back to geometry classes!!
Rectangle Square
Square is a Rectangle
Awww! Cute ducks need software…
And here darkness ends!!
*Shameless copy from some site
Under the tree! Like Budhha
• Are constructors and destructors inherited ?
• How do you prevent a class from being inherited ?
• Can you mark method as sealed ?
• what do you mean by upcasting and downcasting ?
References…
• http://en.wikipedia.org/wiki/Inheritance_%28object-oriented_programming%29
• http://
stackoverflow.com/questions/4428725/can-you-explain-liskov-substitution-principle-with
-a-good-c-sharp-example
• http://en.wikipedia.org/wiki/Liskov_substitution_principle