C# ASP.NET ADO.NET JAVASCRIPT JQUERY AJAX SILVERLIGHT WPF
C# OOPS HTML&CSS DHTML ASP.NET ADO.NET JAVASCRIPT JQUERY AJAX SILVERLIGHT MVVM WPF SQL SERVER Photoshop Dreamweaver Flash Illustrator
Blog Archive
-
2012
(83)
- September(2)
-
August(81)
- Important WPF Classes and Namespaces
- Applications of WPF
- Programming With WPF
- Limitations of Silverlight and flash
- Silverlight Feature comparison with Flash Features
- How to Add XML File in Your Silverlight Project
- 3 Pixel Shader Effects in Silverlight
- Rotate Image in 3D direction using Silverlight
- First Application of Silverlight
- Silverlight 2.0
- How Install Ajax?
- Ajax Advantage
- JavaScript Loops
- Show a Military Clock and ordinary clock
- How To validate a Form in ASP. Net
- How to show Day of Week
- How to Swap a Image using JavaScript
- Special Character in JavaScript
- Prompt Box in JavaScript
- The use of data adapter.?
- The steps involved to fill a dataset?
- Dataset object in ADO .NET
- Handling Connection Events
- The SQLCONNECTION OBJECT
- Command Constructors
- The SQLCOMMAND OBJECT
- Gridview in ASP.NET
- Introduction Of Master Page
- Server Side State Management
- Query String In ASP.NET
- Cookies in ASP.NET
- State Management in ASP.NET
- Various types of application that we can develop i...
- Properties
- Inheritance ,Polymorphism
- Array,Indexer and Collections
- Control Statements
- Operators, types and variables in C#
- Fundamental of C#
- C# & other Programming Languages
- The WPF Designer
- C# DataTypes
- What is Ajax?
- Silverlight 1.0
- Confirm Box in JavaScript
- Component classes
- Life Cycle of ASP.NET
- The Basics of JQuery
- Jquery Blog Content
- Birth Of WPF
- .Net Frameworks Architecture
- History Of Ajax
- Why Silverlight?
- How to access a URL of parent page in ASP. net
- THE ADO.NET Architecture?
- Architecture of ASP.NET
- Introduction Of Ajax
- Ajax Blog Content
- Introduction of SilverLight
- Silverlight Blog Content
- Introduction to Javascript Blog
- Javascript Blog Content
- Introduction to Ado.Net blog
- Ado.Net Blog Content
- Introduction to C# Blog
- C# Blog Content
- Introduction to Asp.Net
- Asp.Net Blog Content
- Introduction to WPF
- WPF Blog Content
- WPF Interview Question
- Silverlight Interview Question
- Ajax Interview Question
- JQuery Interview Question
- Javascript Interview Question
- DHTML Interview Question
- Ado.Net Inetview Questions
- SQL Interview Questions
- HTML&CSS Interview Questions
- Asp.Net Interview Qusetions
- C# Interview Questions
Inheritance ,Polymorphism
Inheritance
In C#, the specialization relationship is generally implemented by using inheritance. Inheritance is also provides the reusability, or we can say that extracts some features from one class to another class.
class Bird
{
public Bird()
{
Console.WriteLine("Bird constructor");
}
public void Greet()
{
Console.WriteLine("Bird says Hello");
}
public void Talk()
{
Console.WriteLine("Bird talk");
}
public virtual void Sing()
{
Console.WriteLine("Bird song");
}
}
class Peacock : Bird
{
public Peacock()
{
Console.WriteLine("Peacock constructor");
}
public new void Talk()
{
Console.WriteLine("Peacock talk");
}
public override void Sing()
{
Console.WriteLine("Peacock song");
}
}
Bird a1 = new Bird();
a1.Talk();
a1.Sing();
a1.Greet();
Bird a2 = new Peacock();
a2.Talk();
a2.Sing();
a2.Greet();
|
Types of Inheritance:
In
Object Oriented Programming concept there are 3 types of inheritances.
1. Single Inheritance,
2. Multiple Inheritance
3. Multilevel Inheritance
Single Inheritance:
public class A
{
}
public class B:A
{
}
Multiple Inheritance:
public class A
{
}
public class B
{
}
public class C:A,B
{
}
Multilevel Inheritance:
public class A
{
}
public class B:A
{
}
public class C:B
{
}
In the above three types C# don't proved Multiple Inheritance. As there is
conflict of multiple override methods in base classes (say A, B in above
example) As in Place C# give another feature called Interfaces using interfaces
you can achieve multiple Inheritance feature.
Polymorphism
Poly means many and morph means form. Thus, polymorphism refers to being able to use many forms of a type without regard to the details.
Creating Polymorphic Types:
For creating polymorphism there are two steps-
1. Create a base class with virtual methods.
2. Create derived classes that override the behavior of the base class’s virtual
methods.
To create a method in a base class that supports polymorphism, mark the method as virtual.
Example.
public class BaseClass
{
public virtual void DoWork()
{
}
public virtual int WorkProperty
{
get {
return 0;
}
}
}
public class DerivedClass : BaseClass
{
public override void DoWork()
{
}
public override int WorkProperty()
{
get {
return 0;
}
}
}
|









