What Is Polymorphism And Virtual Functions In .NET Framework?
Polymorphism and Virtual Functions in .NET Framework.
1 Answer - Sort by: Date | Rating
A while back I was writing a music system, and I decided that I wanted to be able to support both Win Amp and Windows Media Player as playback engines, but I didn't want all of my code to have to know which engine it was using. I therefore defined an abstract class, which is a class that defines the functions a derived class must implement, and that sometimes provides functions that are useful to both classes.
In this case, the abstract class was called Music Server, and it had functions like Play (), Next Song (), Pause (), etc. All of the above functions were confirmed as abstract, so that each player class would have to apply those functions themselves. To make the application trouble-free and easy the polymorphisms and virtual functions have a vital role. Its now clear the role of polymorphisms.
When there is a virtual function, the programmer can go by about an allusion to the abstract class slightly than the derived class, and the compiler will write code to call the suitable version of the function at runtime. In C# the polymorphisms and virtual functions have a good role which the programmers appreciate and enjoy this feature very much.
In this case, the abstract class was called Music Server, and it had functions like Play (), Next Song (), Pause (), etc. All of the above functions were confirmed as abstract, so that each player class would have to apply those functions themselves. To make the application trouble-free and easy the polymorphisms and virtual functions have a vital role. Its now clear the role of polymorphisms.
When there is a virtual function, the programmer can go by about an allusion to the abstract class slightly than the derived class, and the compiler will write code to call the suitable version of the function at runtime. In C# the polymorphisms and virtual functions have a good role which the programmers appreciate and enjoy this feature very much.
0
0
- Do While Loop In C++ Output?
- What Is File-based Approach?
- What Is Cascading Rollback?
- How Do I Create An SQL Queries That Show: Student Name, Address, And Contact Information For All Students? Student Name And The Certificate Program For Which They Are Registered Student Name And The Courses For Which They Are Registered?
- I Need To Create A System Where Students Can Register For One Of 5 Certificates, Select Courses, And Obtain A Transcript Of The Grades Received For The Courses. Each Student Can Be Enrolled For Only One Certificate. There Are 4 Courses In Each Cert?
- How The Efficiency And Integrity Of The Data Is Maintained At All Times Although The Database Is Used By Varying Organisational Levels? 2 Examples
- What Is An Attribute In Java?
- How About Links Of London?
- When You Create A New COM Component In Visual Basic, You Choose The Following Template?
- Why Do We Use Public Static Void Main In Java?
- What Parts Of Wordpad?
- What Do You Mean By Index?
- What Is Indexed File Organization?
- How The Performance Of Database?
- How Is That The Additional Hardware Affect The Data Base Management System?
- How Do You Automate Starting And Shutting Down Of Databases In Unix?
- How Design An Algorithm For The SIMD Computer To Calculate The Sum Of An Array (A) Of 8 Elements. Assume That Element Ai Is Stored In The Local Memory Of PEi, Where I=1,2,3,.......4?
- Do I Have To Write A Main Method In Every Class I Create?Why?
- Do I Have To Write A Main Method In Every Class I Create?
- What Is Centralize Database Management System?
- Why We Indicate FF As 0FF In Program?
- When To Apply For Css?
- How Do I Enable Java On My I465?
- What Are Key Features Of Procedural Programming?
- What Is Conceptual Methodology?
- What Is .net Framework?
- What Is The Function Of .net Framework?
- What Is Functionality Of CTS In .net Framework?
- What Is Dot Net Framework? What Is It's Native Code?
- How Exception Handling Controls In .Net Framework?
- How .NET Framework Deployed The Different Languages In A Single Platform?
- How We Can Edit Data Grid Controls In .NET Framework?
- What Is A DOT NET Framework? Please Provide The Details Of Class Library And CLR And MSIL In Detail.
- How Many Protocols Are There On The Net And What Are Their Functions?how Do They Work?

New Comment - Comments are editable for 5 min.