SlideShare a Scribd company logo
1 of 7
Differences between method overloading and method overriding 
Answer: 
Method Overloading and Method Overriding are both the techniques used to implement FUNCTIONAL 
POLYMORPHISM 
They enhance the methods functionality using their respective features. 
overloading: 
1) It involves having another method with the same name in a class or its derived class. 
2)can be implemented with or without inheritance. 
3)It is implemented by: 
a)changing the number of parameters in different methods with same name. 
b)changing the parameter data types (if the number of parameters are same) 
c)changing parameter order. 
4)applicable to static as well as non static methods: 
5)no keywords needed before the method names in C#. 
6)also called as COMPILE TIME Polymorphism. 
example: int add(int a, int b) 
{ 
return a+b; 
} 
int add(int a) 
{ 
return a*5; 
} 
Overriding: 
1) It involves having another method with the same name in a base class and derived class.
2)always needs inheritance. 
3)It is implemented by having two methods with same name, same signature, but different 
implementations (coding)in a base class and derived class 
4)applicable to nonstatic, nonprivate methods only.access modifiers of the methods are not changed in 
the base and derived classes. 
5)virtual and override keywords are needed before the method names in base and derived classes. 
For overriding in firther classes, override keyword will be used, 
6)RUN TIME Polymorphism 
example: 
class A 
{ 
public virtual void demo() 
{ 
} 
} 
class B:A 
{ 
public override void demo() 
{ 
} 
static void Main() 
{ 
B obj=new B(); 
obj.demo(); 
} 
} 
What is CLS? 
Answer: 
CLS: 
Common Language Specification:
It is a set of the programming rules which every .NET language must follow. 
CLS is used so that the code written in one language is interoperable with the code written in 
another language. The different .NET languages code is compiled into MSIL Code. CLS defines 
the infrastructure for the MSIL Code. The CLR processes the MSIL code and help in its 
execution. This ensures the language interoperability. 
EXAMPLES OF CLS: 
1)Common set of data types for all the languages( CTS) 
Int32 datatype is implemented as int in C# and as integer in VB.NET 
2)Interfaces cannot have static methods.It applies to all the .NET languages. 
The Types which follow the CLS rules are also called as CLS Compliant types. 
CLS compliant languages: 
VB.NET,C#, VC++ 
Use of CLS: 
A class written in VB.NET can be used in C# and vice-versa. 
For the complete list of CLS features, please visit this link. 
http://msdn.microsoft.com/en-us/library/12a7a7h3(VS.71).aspx 
What is .NET Framework? 
Answer: 
.NET (.Network Enabled Technologies) is a collection of development tools 
developed by the Microsoft Corporation that enables the developers to develop 
and execute a large variety of applications 
example: Console,Windows,Web,WPF,WCF, Web Services, Window Services, 
Mobile Applications.
.NET Framework consists of: 
1)CLR: (Common Language Runtime): 
2)FCL: (Framework Class Llivraries) 
3)Languages, Language Compilers 
CLR is the set of components(also called as the execution engine) and provides 
us with many runtime services. 
example: 
1)Managing code execution. 
2)Menory management and Garbage Collection. 
3)Exception handling management 
4)Security and Code Verification 
5)MultiThreading support 
6)Cross Language interoperability using CTS and CLS. 
FCL provides us with the predefined class libraries which have over thousands of 
classes that can be used in development and execution. 
example: System.Data.dl 
System.Windows.Forms.dll 
System.dll 
mscorlib.dll 
Languages :example: VB.NET, C#,VC++ 
Each language ahs its own set of compilers 
ex: vbc for vb.net, csc for csharp. 
Coompilers are used to compile the code and generate the executable files.(Assemblies) 
What is difference between out and ref in c#? 
Answer: 
This is a great .NET Interview question and also very very confusing question. By default parameters are 
always passed by value to methods and functions.If you want to pass data byref then you can use either 
out or ref keyword. 
There are two big difference between these keywords one is the way data is passed between the caller 
code and method and second who is responsible for initialization.
Way the data is passed(directional or bi-directional) 
================================================== 
When you use OUT data is passed only one way i.e from the method to the caller code. 
When you use REF , Data can be passed from the called to the method and also vice versa. 
Who initializes data 
============================================== 
In OUT the variables value has to be intialized in the method. In REF the value is initialized outside the 
method by the caller. 
The most important thing the interviewer will like to hear from you When to use when 
====================================================== 
OUT will be used when you want data to be passed only from the method to the caller. 
REF will be used when you want data to be passed from the called to the method and also vice versa. 
My 100 .NET Interview questions http://www.questpond.com 
What is the difference between .NET 1.1,2.0,3.0,3.5 and 4.0 ? 
Answer: 
The list of differences are huge. In interviews you normally need to short and sweet. So we will list down 
top 5 differences from each section. 
So lets first start with the difference between 1.0 and 2.0. 
Support for 64 bit application. 
Generics 
SQL cache dependency 
Master pages 
Membership and roles 
Now the next difference .NET 2.0 and 3.0 
========================================= 
WCF 
WPF 
WWF 
WCS ( card space) 
3.0 and 3.5
========================================== 
LINQ 
Ajax inbuilt 
ADO Entity framework 
ADO data services 
Multi targeting 
Finally 3.5 and 4.0 
=========================================== 
MEF 
Parallel computing 
DLR dynamic 
Code contract 
language runtime 
Lazy initialization 
Differences between Window and Web Forms 
Answer: 
Window Forms: 
1)They do not need a web browser or web server to execute. 
2)They execute through their respective exe files 
3)They run on the same machine they are displayed on. 
4)Their single instance exists until we close them or dispose them through coding 
5)Used for developing games, inventory management, system utiltites etc. 
6)They run under Code Access Security. 
Web Forms: 
1)They need a web browser as well as a web server(on the server machine only). 
2)They execute through the dll of the web application which is then processed by IIS and the .net
framework. 
3)They run on a remote server and are displayed remotely on the clients. 
4)Every time they are submitted, their new instance is created. 
5)Used in web site development. 
6)They use role based security

More Related Content

What's hot

Introduction to C++ Programming
Introduction to C++ ProgrammingIntroduction to C++ Programming
Introduction to C++ ProgrammingPreeti Kashyap
 
C++ Object oriented concepts & programming
C++ Object oriented concepts & programmingC++ Object oriented concepts & programming
C++ Object oriented concepts & programmingnirajmandaliya
 
Static Data Members and Member Functions
Static Data Members and Member FunctionsStatic Data Members and Member Functions
Static Data Members and Member FunctionsMOHIT AGARWAL
 
C++ overloading
C++ overloadingC++ overloading
C++ overloadingsanya6900
 
Java Tutorial Lab 5
Java Tutorial Lab 5Java Tutorial Lab 5
Java Tutorial Lab 5Berk Soysal
 
Type conversions
Type conversionsType conversions
Type conversionssanya6900
 
Data members and member functions
Data members and member functionsData members and member functions
Data members and member functionsMarlom46
 
Java Tutorial Lab 1
Java Tutorial Lab 1Java Tutorial Lab 1
Java Tutorial Lab 1Berk Soysal
 
Function overloading
Function overloadingFunction overloading
Function overloadingzindadili
 

What's hot (20)

Introduction to C++ Programming
Introduction to C++ ProgrammingIntroduction to C++ Programming
Introduction to C++ Programming
 
C++ Object oriented concepts & programming
C++ Object oriented concepts & programmingC++ Object oriented concepts & programming
C++ Object oriented concepts & programming
 
Static Data Members and Member Functions
Static Data Members and Member FunctionsStatic Data Members and Member Functions
Static Data Members and Member Functions
 
Intake 37 linq1
Intake 37 linq1Intake 37 linq1
Intake 37 linq1
 
Intake 37 1
Intake 37 1Intake 37 1
Intake 37 1
 
C++ overloading
C++ overloadingC++ overloading
C++ overloading
 
Intake 37 linq2
Intake 37 linq2Intake 37 linq2
Intake 37 linq2
 
Function overloading
Function overloadingFunction overloading
Function overloading
 
Java 8 new features
Java 8 new featuresJava 8 new features
Java 8 new features
 
Java Tutorial Lab 5
Java Tutorial Lab 5Java Tutorial Lab 5
Java Tutorial Lab 5
 
Type conversions
Type conversionsType conversions
Type conversions
 
Intake 37 ef2
Intake 37 ef2Intake 37 ef2
Intake 37 ef2
 
Linq
LinqLinq
Linq
 
Data members and member functions
Data members and member functionsData members and member functions
Data members and member functions
 
Intake 37 2
Intake 37 2Intake 37 2
Intake 37 2
 
Java Tutorial Lab 1
Java Tutorial Lab 1Java Tutorial Lab 1
Java Tutorial Lab 1
 
Understanding linq
Understanding linqUnderstanding linq
Understanding linq
 
Inheritance
InheritanceInheritance
Inheritance
 
Function overloading
Function overloadingFunction overloading
Function overloading
 
Inheritance
InheritanceInheritance
Inheritance
 

Viewers also liked

Visula C# Programming Lecture 6
Visula C# Programming Lecture 6Visula C# Programming Lecture 6
Visula C# Programming Lecture 6Abou Bakr Ashraf
 
Object Oriented Programming with C#
Object Oriented Programming with C#Object Oriented Programming with C#
Object Oriented Programming with C#foreverredpb
 
Csc153 chapter 07
Csc153 chapter 07Csc153 chapter 07
Csc153 chapter 07PCC
 
20 most important java programming interview questions
20 most important java programming interview questions20 most important java programming interview questions
20 most important java programming interview questionsGradeup
 
Object Oriented Programming - Value Types & Reference Types
Object Oriented Programming - Value Types & Reference TypesObject Oriented Programming - Value Types & Reference Types
Object Oriented Programming - Value Types & Reference TypesDudy Ali
 
Important java programs(collection+file)
Important java programs(collection+file)Important java programs(collection+file)
Important java programs(collection+file)Alok Kumar
 
Slideshare.Com Powerpoint
Slideshare.Com PowerpointSlideshare.Com Powerpoint
Slideshare.Com Powerpointguested929b
 

Viewers also liked (12)

Lo2
Lo2Lo2
Lo2
 
Csharp_Chap03
Csharp_Chap03Csharp_Chap03
Csharp_Chap03
 
Visula C# Programming Lecture 6
Visula C# Programming Lecture 6Visula C# Programming Lecture 6
Visula C# Programming Lecture 6
 
Object Oriented Programming with C#
Object Oriented Programming with C#Object Oriented Programming with C#
Object Oriented Programming with C#
 
Csc153 chapter 07
Csc153 chapter 07Csc153 chapter 07
Csc153 chapter 07
 
Method overriding
Method overridingMethod overriding
Method overriding
 
20 most important java programming interview questions
20 most important java programming interview questions20 most important java programming interview questions
20 most important java programming interview questions
 
Object Oriented Programming - Value Types & Reference Types
Object Oriented Programming - Value Types & Reference TypesObject Oriented Programming - Value Types & Reference Types
Object Oriented Programming - Value Types & Reference Types
 
Programming in c#
Programming in c#Programming in c#
Programming in c#
 
Important java programs(collection+file)
Important java programs(collection+file)Important java programs(collection+file)
Important java programs(collection+file)
 
Slideshare.Com Powerpoint
Slideshare.Com PowerpointSlideshare.Com Powerpoint
Slideshare.Com Powerpoint
 
Slideshare ppt
Slideshare pptSlideshare ppt
Slideshare ppt
 

Similar to Differences between method overloading and method overriding

C# c# for beginners crash course master c# programming fast and easy today
C# c# for beginners crash course master c# programming fast and easy todayC# c# for beginners crash course master c# programming fast and easy today
C# c# for beginners crash course master c# programming fast and easy todayAfonso Macedo
 
C# interview-questions
C# interview-questionsC# interview-questions
C# interview-questionsnicolbiden
 
Mit4021 c# and .net
Mit4021   c# and .netMit4021   c# and .net
Mit4021 c# and .netsmumbahelp
 
C language 100 questions answers
C language 100 questions answersC language 100 questions answers
C language 100 questions answerssakshitiwari631430
 
Top TCS Interview Questions And Answers | How to Crack An Interview At TCS | ...
Top TCS Interview Questions And Answers | How to Crack An Interview At TCS | ...Top TCS Interview Questions And Answers | How to Crack An Interview At TCS | ...
Top TCS Interview Questions And Answers | How to Crack An Interview At TCS | ...Simplilearn
 
Dotnetintroduce 100324201546-phpapp02
Dotnetintroduce 100324201546-phpapp02Dotnetintroduce 100324201546-phpapp02
Dotnetintroduce 100324201546-phpapp02Wei Sun
 
Dotnet interview qa
Dotnet interview qaDotnet interview qa
Dotnet interview qaabcxyzqaz
 
Dot net interview questions and asnwers
Dot net interview questions and asnwersDot net interview questions and asnwers
Dot net interview questions and asnwerskavinilavuG
 
Introduction to C3.net Architecture unit
Introduction to C3.net Architecture unitIntroduction to C3.net Architecture unit
Introduction to C3.net Architecture unitKotresh Munavallimatt
 

Similar to Differences between method overloading and method overriding (20)

C# interview questions
C# interview questionsC# interview questions
C# interview questions
 
C# interview
C# interviewC# interview
C# interview
 
C# c# for beginners crash course master c# programming fast and easy today
C# c# for beginners crash course master c# programming fast and easy todayC# c# for beginners crash course master c# programming fast and easy today
C# c# for beginners crash course master c# programming fast and easy today
 
C# interview-questions
C# interview-questionsC# interview-questions
C# interview-questions
 
Mit4021 c# and .net
Mit4021   c# and .netMit4021   c# and .net
Mit4021 c# and .net
 
C language 100 questions answers
C language 100 questions answersC language 100 questions answers
C language 100 questions answers
 
Top TCS Interview Questions And Answers | How to Crack An Interview At TCS | ...
Top TCS Interview Questions And Answers | How to Crack An Interview At TCS | ...Top TCS Interview Questions And Answers | How to Crack An Interview At TCS | ...
Top TCS Interview Questions And Answers | How to Crack An Interview At TCS | ...
 
Dotnetintroduce 100324201546-phpapp02
Dotnetintroduce 100324201546-phpapp02Dotnetintroduce 100324201546-phpapp02
Dotnetintroduce 100324201546-phpapp02
 
C# note
C# noteC# note
C# note
 
Dotnet interview qa
Dotnet interview qaDotnet interview qa
Dotnet interview qa
 
Dot net
Dot netDot net
Dot net
 
Asp.net main
Asp.net mainAsp.net main
Asp.net main
 
C++ programing lanuage
C++ programing lanuageC++ programing lanuage
C++ programing lanuage
 
C# Unit 1 notes
C# Unit 1 notesC# Unit 1 notes
C# Unit 1 notes
 
Dot net interview questions and asnwers
Dot net interview questions and asnwersDot net interview questions and asnwers
Dot net interview questions and asnwers
 
Csharp
CsharpCsharp
Csharp
 
Introduction to C3.net Architecture unit
Introduction to C3.net Architecture unitIntroduction to C3.net Architecture unit
Introduction to C3.net Architecture unit
 
C sharp
C sharpC sharp
C sharp
 
Introduction to programming using c
Introduction to programming using cIntroduction to programming using c
Introduction to programming using c
 
Programming
Programming Programming
Programming
 

Recently uploaded

From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 

Recently uploaded (20)

From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 

Differences between method overloading and method overriding

  • 1. Differences between method overloading and method overriding Answer: Method Overloading and Method Overriding are both the techniques used to implement FUNCTIONAL POLYMORPHISM They enhance the methods functionality using their respective features. overloading: 1) It involves having another method with the same name in a class or its derived class. 2)can be implemented with or without inheritance. 3)It is implemented by: a)changing the number of parameters in different methods with same name. b)changing the parameter data types (if the number of parameters are same) c)changing parameter order. 4)applicable to static as well as non static methods: 5)no keywords needed before the method names in C#. 6)also called as COMPILE TIME Polymorphism. example: int add(int a, int b) { return a+b; } int add(int a) { return a*5; } Overriding: 1) It involves having another method with the same name in a base class and derived class.
  • 2. 2)always needs inheritance. 3)It is implemented by having two methods with same name, same signature, but different implementations (coding)in a base class and derived class 4)applicable to nonstatic, nonprivate methods only.access modifiers of the methods are not changed in the base and derived classes. 5)virtual and override keywords are needed before the method names in base and derived classes. For overriding in firther classes, override keyword will be used, 6)RUN TIME Polymorphism example: class A { public virtual void demo() { } } class B:A { public override void demo() { } static void Main() { B obj=new B(); obj.demo(); } } What is CLS? Answer: CLS: Common Language Specification:
  • 3. It is a set of the programming rules which every .NET language must follow. CLS is used so that the code written in one language is interoperable with the code written in another language. The different .NET languages code is compiled into MSIL Code. CLS defines the infrastructure for the MSIL Code. The CLR processes the MSIL code and help in its execution. This ensures the language interoperability. EXAMPLES OF CLS: 1)Common set of data types for all the languages( CTS) Int32 datatype is implemented as int in C# and as integer in VB.NET 2)Interfaces cannot have static methods.It applies to all the .NET languages. The Types which follow the CLS rules are also called as CLS Compliant types. CLS compliant languages: VB.NET,C#, VC++ Use of CLS: A class written in VB.NET can be used in C# and vice-versa. For the complete list of CLS features, please visit this link. http://msdn.microsoft.com/en-us/library/12a7a7h3(VS.71).aspx What is .NET Framework? Answer: .NET (.Network Enabled Technologies) is a collection of development tools developed by the Microsoft Corporation that enables the developers to develop and execute a large variety of applications example: Console,Windows,Web,WPF,WCF, Web Services, Window Services, Mobile Applications.
  • 4. .NET Framework consists of: 1)CLR: (Common Language Runtime): 2)FCL: (Framework Class Llivraries) 3)Languages, Language Compilers CLR is the set of components(also called as the execution engine) and provides us with many runtime services. example: 1)Managing code execution. 2)Menory management and Garbage Collection. 3)Exception handling management 4)Security and Code Verification 5)MultiThreading support 6)Cross Language interoperability using CTS and CLS. FCL provides us with the predefined class libraries which have over thousands of classes that can be used in development and execution. example: System.Data.dl System.Windows.Forms.dll System.dll mscorlib.dll Languages :example: VB.NET, C#,VC++ Each language ahs its own set of compilers ex: vbc for vb.net, csc for csharp. Coompilers are used to compile the code and generate the executable files.(Assemblies) What is difference between out and ref in c#? Answer: This is a great .NET Interview question and also very very confusing question. By default parameters are always passed by value to methods and functions.If you want to pass data byref then you can use either out or ref keyword. There are two big difference between these keywords one is the way data is passed between the caller code and method and second who is responsible for initialization.
  • 5. Way the data is passed(directional or bi-directional) ================================================== When you use OUT data is passed only one way i.e from the method to the caller code. When you use REF , Data can be passed from the called to the method and also vice versa. Who initializes data ============================================== In OUT the variables value has to be intialized in the method. In REF the value is initialized outside the method by the caller. The most important thing the interviewer will like to hear from you When to use when ====================================================== OUT will be used when you want data to be passed only from the method to the caller. REF will be used when you want data to be passed from the called to the method and also vice versa. My 100 .NET Interview questions http://www.questpond.com What is the difference between .NET 1.1,2.0,3.0,3.5 and 4.0 ? Answer: The list of differences are huge. In interviews you normally need to short and sweet. So we will list down top 5 differences from each section. So lets first start with the difference between 1.0 and 2.0. Support for 64 bit application. Generics SQL cache dependency Master pages Membership and roles Now the next difference .NET 2.0 and 3.0 ========================================= WCF WPF WWF WCS ( card space) 3.0 and 3.5
  • 6. ========================================== LINQ Ajax inbuilt ADO Entity framework ADO data services Multi targeting Finally 3.5 and 4.0 =========================================== MEF Parallel computing DLR dynamic Code contract language runtime Lazy initialization Differences between Window and Web Forms Answer: Window Forms: 1)They do not need a web browser or web server to execute. 2)They execute through their respective exe files 3)They run on the same machine they are displayed on. 4)Their single instance exists until we close them or dispose them through coding 5)Used for developing games, inventory management, system utiltites etc. 6)They run under Code Access Security. Web Forms: 1)They need a web browser as well as a web server(on the server machine only). 2)They execute through the dll of the web application which is then processed by IIS and the .net
  • 7. framework. 3)They run on a remote server and are displayed remotely on the clients. 4)Every time they are submitted, their new instance is created. 5)Used in web site development. 6)They use role based security