C# basics training (Inheritance)

11
Coding Horror The scary show for Programmers Based on True stories from the desk of software programmers

description

Our C# basics training slides, which we used in out recent training batch

Transcript of C# basics training (Inheritance)

Page 1: C# basics training (Inheritance)

Coding HorrorThe scary show for Programmers

Based on True stories from the desk of software

programmers

Page 2: C# basics training (Inheritance)

InheritanceEpisode #1

Page 3: C# basics training (Inheritance)

About the dumbledores

Syed Mansoor Ahmed

(Project Manager)- Proud Wiproite from

last 10 Yrs- Leads AppC

Automation team

[email protected]

Ankit Kashyap(Analyst Programmer)

- Proud Wiproite from last 5.9 Yrs

- Works as developer; take care of AppC tools

[email protected]

Page 4: C# basics training (Inheritance)

Why We need it?

Code Reuse!!

Polymorphism

Many more…

Page 5: C# basics training (Inheritance)

Open Close Principle

“software entities (classes, modules, functions, etc.) should be open for extension,

but closed for modification”-from Wikipedia

Page 6: C# basics training (Inheritance)

We all know Inheritance! Yay!!

Let’s check it!!!

Time for hands-on…

Car is a vehicle! So

sweet!!

Page 7: C# basics training (Inheritance)

Back to geometry classes!!

Rectangle Square

Square is a Rectangle

Page 8: C# basics training (Inheritance)

Awww! Cute ducks need software…

Page 9: C# basics training (Inheritance)

And here darkness ends!!

*Shameless copy from some site

Page 10: C# basics training (Inheritance)

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 ?