尊敬的 微信汇率:1円 ≈ 0.046166 元 支付宝汇率:1円 ≈ 0.046257元 [退出登录]
SlideShare a Scribd company logo
By
G.KARTHIGA MSC IT
NADAR SARASWATHI COLLEGE OF
ARTS AND SCIENCE
THENI
 Definition:-
"Manipulated the object of various classes and invoke method on
one object without knowing the object type".
 Polymorphism can be divide in to two parts, that are given bellow:
1) Compile time polymorphism
2) Run time polymorphism
Compile time polymorphism:-
compile time polymorphism achieved by "Method
Overloading", means that same name function with deferent
parameters in same class called compile time polymorphism.
 Interfaces allow us to create definitions for
component interaction.
 They also provide another way of
implementing polymorphism.
 The public members are thought of as
comprising the class's interface because they
are the only way that code outside of the
class can interact (i.e., interface) with objects
of that class.
 In software development, the interface is the faculty
of abstraction, coupling (loose or tight), and
polymorphism.
 The formal interface class provides an important
facility for polymorphism in .NET.
 The implementation of the IClonable, IComparable,
and IEnumerable interfaces.
 This factoring is the process of deciding what
properties, events, and methods are to be included in
a certain interface.
 When you start cluttering up the interface with
unrelated methods and properties.
 For example:
 splitting a collection of ten financial methods for
an accounting interface into two interfaces, one for
debits and one for credits,
 The Implements keyword as demonstrated earlier to
signify that a class implements a specific interface.
 This is achieved by providing a comma−separated list
behind the Implements keyword, as follows:
Public Class SeaFood
Implements IShrimps, IScallops,
IOysters, ICrabs
 Building component-based solutions has a number of
unique problems and benefits.
 The completed implementation can be used, and
finally some time later, a completely new
implementation can be used to replace the initial
implementation.
 Interfaces make the complete software development
process easier.
 A few enhancements have been made to interfaces in
Visual Basic.NET. The most important of these is that
events can now be part of an interface.
 The mechanism for defining an interface has also
been changed.
 This technique allows a developer to continually
change which component he actually uses.
 Interfaces are better suited to situations in which your
applications require many possibly unrelated object
types to provide certain functionality.
 Interfaces are more flexible than base classes because
you can define a single implementation that can
implement multiple interfaces.
 Interfaces are better in situations in which you do not
have to inherit implementation from a base class.
 In a namespace, interface statements are Friend by
default, but they can also be explicitly declared
as Public or Friend. Interfaces defined within classes,
modules, interfaces, and structures are Public by
default, but they can also be explicitly declared
as Public, Friend, Protected, or Private.
 Interfaces cannot contain any implementation code or
statements associated with implementation code, such
as End Sub or End Property.
 The Visual Basic reserved word Implements is used
in two ways.
 The Implements statement signifies that a class or
structure implements an interface.
 The Implements keyword signifies that a class
member or structure member implements a specific
interface member.
 The Implements keyword requires a comma-
separated list of interface members to be
implemented.
 The specification of an interface member consists of
the interface name, which must be specified in an
implements statement within the class; a period; and
the name of the member function, property, or event
to be implemented.
 The name of a member that implements an interface
member can use any legal identifier.
Class Class1
Implements interfaceclass.interface2
Sub Sub1(ByVal i AsInteger)
Implements interfaceclass.interface2.Sub1
EndSub
EndClass
 Polymorphism implies that you can have many
different implementations (code) of a method behind
a single interface.
 Methods are defined in interfaces by providing only
the signature, which consists of the method's
identifier ( and formal parameter list.
 The interface and the definition become part of a
contract between the implement and the interface
provider for the purpose of enabling polymorphism at
the method level.
 In interface-based polymorphism, the interface
defines the properties, methods, and events to be
implemented similar to the definition of abstract
members in a class.
 The syntax to define the interface appears as follows:
[Public|Friend|Private|Protected] Interface
Name„
Interface definition statements
End Interface
 All standard class declarations and member
declarations implicitly expose interfaces so that their
objects can be referenced and their functionality and
data accessed in predefined and regulated ways.
 This implicit, but always present, interface comprises
the standard object's identifier and the encapsulated
method signatures
 In .NET provides a form of reference type that allows
you to explicitly declare an interface and keep it
completely separate from any implementation.
 In other words, the interface class and the class that
implements the interface represent the most loosely
coupled arrangement of classes you can achieve in
the .NET Framework.
 An interface may also extend another interface.
 In that case, the extender is known as the super interface and
the extended is the sub interface.
 Example:
interface AInterface{
int A();
}
interface AInterface2 extends AInterface{
int a2();
}
Interface Interface1
Sub sub1(ByVal i As Integer)
End Interface
‘Demonstrates interface inheritance’.
Interface Interface2
Inherits Interface1
Sub M1(ByVal y As Integer)
ReadOnly Property Num() As Integer
End Interface
 Interfaces define the properties, methods, and events
that classes can implement. Interfaces allow you to
define features as small groups of closely related
properties, methods, and events; this reduces
compatibility problems.
 You can add new features at any time by developing
additional interfaces and implementations.

More Related Content

What's hot

Internet address
Internet addressInternet address
Internet address
Shubham Dwivedi
 
TCP/IP Protocols With All Layer Description
TCP/IP Protocols With All Layer DescriptionTCP/IP Protocols With All Layer Description
TCP/IP Protocols With All Layer Description
Shubham Khedekar
 
Remote procedure call on client server computing
Remote procedure call on client server computingRemote procedure call on client server computing
Remote procedure call on client server computing
Satya P. Joshi
 
Packet tracer
Packet tracerPacket tracer
Packet tracer
Imdad Ullah
 
TCP/ IP
TCP/ IP TCP/ IP
package mangement
package mangementpackage mangement
package mangement
ARYA TM
 
Unix features, posix and single unix specification
Unix features, posix and single unix specificationUnix features, posix and single unix specification
Unix features, posix and single unix specification
sudha rani
 
Osi model
Osi modelOsi model
Osi model
Priyanka Sharma
 
Symbol table in compiler Design
Symbol table in compiler DesignSymbol table in compiler Design
Symbol table in compiler Design
Kuppusamy P
 
File Transfer Protocol
File Transfer ProtocolFile Transfer Protocol
File Transfer Protocol
guest029bcd
 
Client Server Architecture
Client Server ArchitectureClient Server Architecture
Client Server Architecture
Rence Montanes
 
Threads (operating System)
Threads (operating System)Threads (operating System)
Threads (operating System)
Prakhar Maurya
 
Inter Process Communication Presentation[1]
Inter Process Communication Presentation[1]Inter Process Communication Presentation[1]
Inter Process Communication Presentation[1]
Ravindra Raju Kolahalam
 
Client server architecture
Client server architectureClient server architecture
Client server architecture
Bhargav Amin
 
Computer networking 1
Computer networking 1Computer networking 1
Computer networking 1
Prof. Dr. K. Adisesha
 
Distance Vector Routing Protocols
Distance Vector Routing ProtocolsDistance Vector Routing Protocols
Distance Vector Routing Protocols
KABILESH RAMAR
 
two tier and three tier
two tier and three tiertwo tier and three tier
two tier and three tier
Kashafnaz2
 
FIREWALL
FIREWALL FIREWALL
FIREWALL
Akash R
 
Transmission Control Protocol (TCP)
Transmission Control Protocol (TCP)Transmission Control Protocol (TCP)
Transmission Control Protocol (TCP)
k33a
 
Hub, switch, router, bridge & and repeater
Hub, switch, router, bridge & and repeaterHub, switch, router, bridge & and repeater
Hub, switch, router, bridge & and repeater
Maksudujjaman
 

What's hot (20)

Internet address
Internet addressInternet address
Internet address
 
TCP/IP Protocols With All Layer Description
TCP/IP Protocols With All Layer DescriptionTCP/IP Protocols With All Layer Description
TCP/IP Protocols With All Layer Description
 
Remote procedure call on client server computing
Remote procedure call on client server computingRemote procedure call on client server computing
Remote procedure call on client server computing
 
Packet tracer
Packet tracerPacket tracer
Packet tracer
 
TCP/ IP
TCP/ IP TCP/ IP
TCP/ IP
 
package mangement
package mangementpackage mangement
package mangement
 
Unix features, posix and single unix specification
Unix features, posix and single unix specificationUnix features, posix and single unix specification
Unix features, posix and single unix specification
 
Osi model
Osi modelOsi model
Osi model
 
Symbol table in compiler Design
Symbol table in compiler DesignSymbol table in compiler Design
Symbol table in compiler Design
 
File Transfer Protocol
File Transfer ProtocolFile Transfer Protocol
File Transfer Protocol
 
Client Server Architecture
Client Server ArchitectureClient Server Architecture
Client Server Architecture
 
Threads (operating System)
Threads (operating System)Threads (operating System)
Threads (operating System)
 
Inter Process Communication Presentation[1]
Inter Process Communication Presentation[1]Inter Process Communication Presentation[1]
Inter Process Communication Presentation[1]
 
Client server architecture
Client server architectureClient server architecture
Client server architecture
 
Computer networking 1
Computer networking 1Computer networking 1
Computer networking 1
 
Distance Vector Routing Protocols
Distance Vector Routing ProtocolsDistance Vector Routing Protocols
Distance Vector Routing Protocols
 
two tier and three tier
two tier and three tiertwo tier and three tier
two tier and three tier
 
FIREWALL
FIREWALL FIREWALL
FIREWALL
 
Transmission Control Protocol (TCP)
Transmission Control Protocol (TCP)Transmission Control Protocol (TCP)
Transmission Control Protocol (TCP)
 
Hub, switch, router, bridge & and repeater
Hub, switch, router, bridge & and repeaterHub, switch, router, bridge & and repeater
Hub, switch, router, bridge & and repeater
 

Similar to Polymorphism and interface in vb.net

C# concepts
C# conceptsC# concepts
C# concepts
lexilijoseph
 
C#.net interview questions for dynamics 365 ce crm developers
C#.net interview questions for dynamics 365 ce crm developersC#.net interview questions for dynamics 365 ce crm developers
C#.net interview questions for dynamics 365 ce crm developers
Sanjaya Prakash Pradhan
 
abstract class and interface.Net
abstract class and interface.Netabstract class and interface.Net
abstract class and interface.Net
BGSBU Rajouri
 
Aspect Oriented Programming Through C#.NET
Aspect Oriented Programming Through C#.NETAspect Oriented Programming Through C#.NET
Aspect Oriented Programming Through C#.NET
Waqas Tariq
 
Core_Java_Interview.pdf
Core_Java_Interview.pdfCore_Java_Interview.pdf
Core_Java_Interview.pdf
ansariparveen06
 
Fundamentals of oops in .Net
Fundamentals of oops in .NetFundamentals of oops in .Net
Fundamentals of oops in .Net
Harman Bajwa
 
Visual Basic –User Interface- V
Visual Basic –User Interface- VVisual Basic –User Interface- V
Visual Basic –User Interface- V
Sharbani Bhattacharya
 
Dot Net Interview Questions - Part 1
Dot Net Interview Questions - Part 1Dot Net Interview Questions - Part 1
Dot Net Interview Questions - Part 1
ReKruiTIn.com
 
Encapsulation
EncapsulationEncapsulation
Encapsulation
FALLEE31188
 
A Programmatic View and Implementation of XML
A Programmatic View and Implementation of XMLA Programmatic View and Implementation of XML
A Programmatic View and Implementation of XML
CSCJournals
 
Interoduction to c++
Interoduction to c++Interoduction to c++
Interoduction to c++
Amresh Raj
 
Facade pattern
Facade patternFacade pattern
Facade pattern
Shakil Ahmed
 
Interface in Java
Interface in JavaInterface in Java
Interface in Java
Ducat India
 
Lecture 18
Lecture 18Lecture 18
Lecture 18
talha ijaz
 
Answer ado.net pre-exam2018
Answer ado.net pre-exam2018Answer ado.net pre-exam2018
Answer ado.net pre-exam2018
than sare
 
Object Oriented Programming In .Net
Object Oriented Programming In .NetObject Oriented Programming In .Net
Object Oriented Programming In .Net
Greg Sohl
 
OOFeatures_revised-2.pptx
OOFeatures_revised-2.pptxOOFeatures_revised-2.pptx
OOFeatures_revised-2.pptx
ssuser84e52e
 
Understanding And Using Reflection
Understanding And Using ReflectionUnderstanding And Using Reflection
Understanding And Using Reflection
Ganesh Samarthyam
 
C# Unit 1 notes
C# Unit 1 notesC# Unit 1 notes
C# Unit 1 notes
Sudarshan Dhondaley
 
Understanding class, object & interface
Understanding class, object & interfaceUnderstanding class, object & interface
Understanding class, object & interface
MD. Shohag Mia
 

Similar to Polymorphism and interface in vb.net (20)

C# concepts
C# conceptsC# concepts
C# concepts
 
C#.net interview questions for dynamics 365 ce crm developers
C#.net interview questions for dynamics 365 ce crm developersC#.net interview questions for dynamics 365 ce crm developers
C#.net interview questions for dynamics 365 ce crm developers
 
abstract class and interface.Net
abstract class and interface.Netabstract class and interface.Net
abstract class and interface.Net
 
Aspect Oriented Programming Through C#.NET
Aspect Oriented Programming Through C#.NETAspect Oriented Programming Through C#.NET
Aspect Oriented Programming Through C#.NET
 
Core_Java_Interview.pdf
Core_Java_Interview.pdfCore_Java_Interview.pdf
Core_Java_Interview.pdf
 
Fundamentals of oops in .Net
Fundamentals of oops in .NetFundamentals of oops in .Net
Fundamentals of oops in .Net
 
Visual Basic –User Interface- V
Visual Basic –User Interface- VVisual Basic –User Interface- V
Visual Basic –User Interface- V
 
Dot Net Interview Questions - Part 1
Dot Net Interview Questions - Part 1Dot Net Interview Questions - Part 1
Dot Net Interview Questions - Part 1
 
Encapsulation
EncapsulationEncapsulation
Encapsulation
 
A Programmatic View and Implementation of XML
A Programmatic View and Implementation of XMLA Programmatic View and Implementation of XML
A Programmatic View and Implementation of XML
 
Interoduction to c++
Interoduction to c++Interoduction to c++
Interoduction to c++
 
Facade pattern
Facade patternFacade pattern
Facade pattern
 
Interface in Java
Interface in JavaInterface in Java
Interface in Java
 
Lecture 18
Lecture 18Lecture 18
Lecture 18
 
Answer ado.net pre-exam2018
Answer ado.net pre-exam2018Answer ado.net pre-exam2018
Answer ado.net pre-exam2018
 
Object Oriented Programming In .Net
Object Oriented Programming In .NetObject Oriented Programming In .Net
Object Oriented Programming In .Net
 
OOFeatures_revised-2.pptx
OOFeatures_revised-2.pptxOOFeatures_revised-2.pptx
OOFeatures_revised-2.pptx
 
Understanding And Using Reflection
Understanding And Using ReflectionUnderstanding And Using Reflection
Understanding And Using Reflection
 
C# Unit 1 notes
C# Unit 1 notesC# Unit 1 notes
C# Unit 1 notes
 
Understanding class, object & interface
Understanding class, object & interfaceUnderstanding class, object & interface
Understanding class, object & interface
 

More from KarthigaGunasekaran1

oracle
oracleoracle
inheritance and polymorphism
inheritance and polymorphisminheritance and polymorphism
inheritance and polymorphism
KarthigaGunasekaran1
 
Hive and querying data
Hive and querying dataHive and querying data
Hive and querying data
KarthigaGunasekaran1
 
Buffer management
Buffer managementBuffer management
Buffer management
KarthigaGunasekaran1
 
unit testing and debugging
unit testing and debuggingunit testing and debugging
unit testing and debugging
KarthigaGunasekaran1
 
System testing
System testingSystem testing
System testing
KarthigaGunasekaran1
 
Data mining techniques
Data mining techniquesData mining techniques
Data mining techniques
KarthigaGunasekaran1
 
Operasting system service
Operasting system serviceOperasting system service
Operasting system service
KarthigaGunasekaran1
 
High level data link control
High level data link controlHigh level data link control
High level data link control
KarthigaGunasekaran1
 
Packages and interface
Packages and interfacePackages and interface
Packages and interface
KarthigaGunasekaran1
 

More from KarthigaGunasekaran1 (10)

oracle
oracleoracle
oracle
 
inheritance and polymorphism
inheritance and polymorphisminheritance and polymorphism
inheritance and polymorphism
 
Hive and querying data
Hive and querying dataHive and querying data
Hive and querying data
 
Buffer management
Buffer managementBuffer management
Buffer management
 
unit testing and debugging
unit testing and debuggingunit testing and debugging
unit testing and debugging
 
System testing
System testingSystem testing
System testing
 
Data mining techniques
Data mining techniquesData mining techniques
Data mining techniques
 
Operasting system service
Operasting system serviceOperasting system service
Operasting system service
 
High level data link control
High level data link controlHigh level data link control
High level data link control
 
Packages and interface
Packages and interfacePackages and interface
Packages and interface
 

Recently uploaded

Keynote given on June 24 for MASSP at Grand Traverse City
Keynote given on June 24 for MASSP at Grand Traverse CityKeynote given on June 24 for MASSP at Grand Traverse City
Keynote given on June 24 for MASSP at Grand Traverse City
PJ Caposey
 
The Rise of the Digital Telecommunication Marketplace.pptx
The Rise of the Digital Telecommunication Marketplace.pptxThe Rise of the Digital Telecommunication Marketplace.pptx
The Rise of the Digital Telecommunication Marketplace.pptx
PriyaKumari928991
 
Post init hook in the odoo 17 ERP Module
Post init hook in the  odoo 17 ERP ModulePost init hook in the  odoo 17 ERP Module
Post init hook in the odoo 17 ERP Module
Celine George
 
Diversity Quiz Prelims by Quiz Club, IIT Kanpur
Diversity Quiz Prelims by Quiz Club, IIT KanpurDiversity Quiz Prelims by Quiz Club, IIT Kanpur
Diversity Quiz Prelims by Quiz Club, IIT Kanpur
Quiz Club IIT Kanpur
 
Brand Guideline of Bashundhara A4 Paper - 2024
Brand Guideline of Bashundhara A4 Paper - 2024Brand Guideline of Bashundhara A4 Paper - 2024
Brand Guideline of Bashundhara A4 Paper - 2024
khabri85
 
8+8+8 Rule Of Time Management For Better Productivity
8+8+8 Rule Of Time Management For Better Productivity8+8+8 Rule Of Time Management For Better Productivity
8+8+8 Rule Of Time Management For Better Productivity
RuchiRathor2
 
How to stay relevant as a cyber professional: Skills, trends and career paths...
How to stay relevant as a cyber professional: Skills, trends and career paths...How to stay relevant as a cyber professional: Skills, trends and career paths...
How to stay relevant as a cyber professional: Skills, trends and career paths...
Infosec
 
How to Create a Stage or a Pipeline in Odoo 17 CRM
How to Create a Stage or a Pipeline in Odoo 17 CRMHow to Create a Stage or a Pipeline in Odoo 17 CRM
How to Create a Stage or a Pipeline in Odoo 17 CRM
Celine George
 
How to Download & Install Module From the Odoo App Store in Odoo 17
How to Download & Install Module From the Odoo App Store in Odoo 17How to Download & Install Module From the Odoo App Store in Odoo 17
How to Download & Install Module From the Odoo App Store in Odoo 17
Celine George
 
What are the new features in the Fleet Odoo 17
What are the new features in the Fleet Odoo 17What are the new features in the Fleet Odoo 17
What are the new features in the Fleet Odoo 17
Celine George
 
Creativity for Innovation and Speechmaking
Creativity for Innovation and SpeechmakingCreativity for Innovation and Speechmaking
Creativity for Innovation and Speechmaking
MattVassar1
 
bryophytes.pptx bsc botany honours second semester
bryophytes.pptx bsc botany honours  second semesterbryophytes.pptx bsc botany honours  second semester
bryophytes.pptx bsc botany honours second semester
Sarojini38
 
Non-Verbal Communication for Tech Professionals
Non-Verbal Communication for Tech ProfessionalsNon-Verbal Communication for Tech Professionals
Non-Verbal Communication for Tech Professionals
MattVassar1
 
78 Microsoft-Publisher - Sirin Sultana Bora.pptx
78 Microsoft-Publisher - Sirin Sultana Bora.pptx78 Microsoft-Publisher - Sirin Sultana Bora.pptx
78 Microsoft-Publisher - Sirin Sultana Bora.pptx
Kalna College
 
How to Create User Notification in Odoo 17
How to Create User Notification in Odoo 17How to Create User Notification in Odoo 17
How to Create User Notification in Odoo 17
Celine George
 
The Science of Learning: implications for modern teaching
The Science of Learning: implications for modern teachingThe Science of Learning: implications for modern teaching
The Science of Learning: implications for modern teaching
Derek Wenmoth
 
Erasmus + DISSEMINATION ACTIVITIES Croatia
Erasmus + DISSEMINATION ACTIVITIES CroatiaErasmus + DISSEMINATION ACTIVITIES Croatia
Erasmus + DISSEMINATION ACTIVITIES Croatia
whatchangedhowreflec
 
(T.L.E.) Agriculture: "Ornamental Plants"
(T.L.E.) Agriculture: "Ornamental Plants"(T.L.E.) Agriculture: "Ornamental Plants"
(T.L.E.) Agriculture: "Ornamental Plants"
MJDuyan
 
managing Behaviour in early childhood education.pptx
managing Behaviour in early childhood education.pptxmanaging Behaviour in early childhood education.pptx
managing Behaviour in early childhood education.pptx
nabaegha
 
The basics of sentences session 8pptx.pptx
The basics of sentences session 8pptx.pptxThe basics of sentences session 8pptx.pptx
The basics of sentences session 8pptx.pptx
heathfieldcps1
 

Recently uploaded (20)

Keynote given on June 24 for MASSP at Grand Traverse City
Keynote given on June 24 for MASSP at Grand Traverse CityKeynote given on June 24 for MASSP at Grand Traverse City
Keynote given on June 24 for MASSP at Grand Traverse City
 
The Rise of the Digital Telecommunication Marketplace.pptx
The Rise of the Digital Telecommunication Marketplace.pptxThe Rise of the Digital Telecommunication Marketplace.pptx
The Rise of the Digital Telecommunication Marketplace.pptx
 
Post init hook in the odoo 17 ERP Module
Post init hook in the  odoo 17 ERP ModulePost init hook in the  odoo 17 ERP Module
Post init hook in the odoo 17 ERP Module
 
Diversity Quiz Prelims by Quiz Club, IIT Kanpur
Diversity Quiz Prelims by Quiz Club, IIT KanpurDiversity Quiz Prelims by Quiz Club, IIT Kanpur
Diversity Quiz Prelims by Quiz Club, IIT Kanpur
 
Brand Guideline of Bashundhara A4 Paper - 2024
Brand Guideline of Bashundhara A4 Paper - 2024Brand Guideline of Bashundhara A4 Paper - 2024
Brand Guideline of Bashundhara A4 Paper - 2024
 
8+8+8 Rule Of Time Management For Better Productivity
8+8+8 Rule Of Time Management For Better Productivity8+8+8 Rule Of Time Management For Better Productivity
8+8+8 Rule Of Time Management For Better Productivity
 
How to stay relevant as a cyber professional: Skills, trends and career paths...
How to stay relevant as a cyber professional: Skills, trends and career paths...How to stay relevant as a cyber professional: Skills, trends and career paths...
How to stay relevant as a cyber professional: Skills, trends and career paths...
 
How to Create a Stage or a Pipeline in Odoo 17 CRM
How to Create a Stage or a Pipeline in Odoo 17 CRMHow to Create a Stage or a Pipeline in Odoo 17 CRM
How to Create a Stage or a Pipeline in Odoo 17 CRM
 
How to Download & Install Module From the Odoo App Store in Odoo 17
How to Download & Install Module From the Odoo App Store in Odoo 17How to Download & Install Module From the Odoo App Store in Odoo 17
How to Download & Install Module From the Odoo App Store in Odoo 17
 
What are the new features in the Fleet Odoo 17
What are the new features in the Fleet Odoo 17What are the new features in the Fleet Odoo 17
What are the new features in the Fleet Odoo 17
 
Creativity for Innovation and Speechmaking
Creativity for Innovation and SpeechmakingCreativity for Innovation and Speechmaking
Creativity for Innovation and Speechmaking
 
bryophytes.pptx bsc botany honours second semester
bryophytes.pptx bsc botany honours  second semesterbryophytes.pptx bsc botany honours  second semester
bryophytes.pptx bsc botany honours second semester
 
Non-Verbal Communication for Tech Professionals
Non-Verbal Communication for Tech ProfessionalsNon-Verbal Communication for Tech Professionals
Non-Verbal Communication for Tech Professionals
 
78 Microsoft-Publisher - Sirin Sultana Bora.pptx
78 Microsoft-Publisher - Sirin Sultana Bora.pptx78 Microsoft-Publisher - Sirin Sultana Bora.pptx
78 Microsoft-Publisher - Sirin Sultana Bora.pptx
 
How to Create User Notification in Odoo 17
How to Create User Notification in Odoo 17How to Create User Notification in Odoo 17
How to Create User Notification in Odoo 17
 
The Science of Learning: implications for modern teaching
The Science of Learning: implications for modern teachingThe Science of Learning: implications for modern teaching
The Science of Learning: implications for modern teaching
 
Erasmus + DISSEMINATION ACTIVITIES Croatia
Erasmus + DISSEMINATION ACTIVITIES CroatiaErasmus + DISSEMINATION ACTIVITIES Croatia
Erasmus + DISSEMINATION ACTIVITIES Croatia
 
(T.L.E.) Agriculture: "Ornamental Plants"
(T.L.E.) Agriculture: "Ornamental Plants"(T.L.E.) Agriculture: "Ornamental Plants"
(T.L.E.) Agriculture: "Ornamental Plants"
 
managing Behaviour in early childhood education.pptx
managing Behaviour in early childhood education.pptxmanaging Behaviour in early childhood education.pptx
managing Behaviour in early childhood education.pptx
 
The basics of sentences session 8pptx.pptx
The basics of sentences session 8pptx.pptxThe basics of sentences session 8pptx.pptx
The basics of sentences session 8pptx.pptx
 

Polymorphism and interface in vb.net

  • 1. By G.KARTHIGA MSC IT NADAR SARASWATHI COLLEGE OF ARTS AND SCIENCE THENI
  • 2.  Definition:- "Manipulated the object of various classes and invoke method on one object without knowing the object type".  Polymorphism can be divide in to two parts, that are given bellow: 1) Compile time polymorphism 2) Run time polymorphism Compile time polymorphism:- compile time polymorphism achieved by "Method Overloading", means that same name function with deferent parameters in same class called compile time polymorphism.
  • 3.  Interfaces allow us to create definitions for component interaction.  They also provide another way of implementing polymorphism.  The public members are thought of as comprising the class's interface because they are the only way that code outside of the class can interact (i.e., interface) with objects of that class.
  • 4.  In software development, the interface is the faculty of abstraction, coupling (loose or tight), and polymorphism.  The formal interface class provides an important facility for polymorphism in .NET.  The implementation of the IClonable, IComparable, and IEnumerable interfaces.
  • 5.  This factoring is the process of deciding what properties, events, and methods are to be included in a certain interface.  When you start cluttering up the interface with unrelated methods and properties.  For example:  splitting a collection of ten financial methods for an accounting interface into two interfaces, one for debits and one for credits,
  • 6.  The Implements keyword as demonstrated earlier to signify that a class implements a specific interface.  This is achieved by providing a comma−separated list behind the Implements keyword, as follows: Public Class SeaFood Implements IShrimps, IScallops, IOysters, ICrabs
  • 7.  Building component-based solutions has a number of unique problems and benefits.  The completed implementation can be used, and finally some time later, a completely new implementation can be used to replace the initial implementation.  Interfaces make the complete software development process easier.
  • 8.  A few enhancements have been made to interfaces in Visual Basic.NET. The most important of these is that events can now be part of an interface.  The mechanism for defining an interface has also been changed.  This technique allows a developer to continually change which component he actually uses.
  • 9.  Interfaces are better suited to situations in which your applications require many possibly unrelated object types to provide certain functionality.  Interfaces are more flexible than base classes because you can define a single implementation that can implement multiple interfaces.  Interfaces are better in situations in which you do not have to inherit implementation from a base class.
  • 10.  In a namespace, interface statements are Friend by default, but they can also be explicitly declared as Public or Friend. Interfaces defined within classes, modules, interfaces, and structures are Public by default, but they can also be explicitly declared as Public, Friend, Protected, or Private.  Interfaces cannot contain any implementation code or statements associated with implementation code, such as End Sub or End Property.
  • 11.  The Visual Basic reserved word Implements is used in two ways.  The Implements statement signifies that a class or structure implements an interface.  The Implements keyword signifies that a class member or structure member implements a specific interface member.
  • 12.  The Implements keyword requires a comma- separated list of interface members to be implemented.  The specification of an interface member consists of the interface name, which must be specified in an implements statement within the class; a period; and the name of the member function, property, or event to be implemented.  The name of a member that implements an interface member can use any legal identifier.
  • 13. Class Class1 Implements interfaceclass.interface2 Sub Sub1(ByVal i AsInteger) Implements interfaceclass.interface2.Sub1 EndSub EndClass
  • 14.  Polymorphism implies that you can have many different implementations (code) of a method behind a single interface.  Methods are defined in interfaces by providing only the signature, which consists of the method's identifier ( and formal parameter list.  The interface and the definition become part of a contract between the implement and the interface provider for the purpose of enabling polymorphism at the method level.
  • 15.  In interface-based polymorphism, the interface defines the properties, methods, and events to be implemented similar to the definition of abstract members in a class.  The syntax to define the interface appears as follows: [Public|Friend|Private|Protected] Interface Name„ Interface definition statements End Interface
  • 16.  All standard class declarations and member declarations implicitly expose interfaces so that their objects can be referenced and their functionality and data accessed in predefined and regulated ways.  This implicit, but always present, interface comprises the standard object's identifier and the encapsulated method signatures
  • 17.  In .NET provides a form of reference type that allows you to explicitly declare an interface and keep it completely separate from any implementation.  In other words, the interface class and the class that implements the interface represent the most loosely coupled arrangement of classes you can achieve in the .NET Framework.
  • 18.  An interface may also extend another interface.  In that case, the extender is known as the super interface and the extended is the sub interface.  Example: interface AInterface{ int A(); } interface AInterface2 extends AInterface{ int a2(); }
  • 19. Interface Interface1 Sub sub1(ByVal i As Integer) End Interface ‘Demonstrates interface inheritance’. Interface Interface2 Inherits Interface1 Sub M1(ByVal y As Integer) ReadOnly Property Num() As Integer End Interface
  • 20.  Interfaces define the properties, methods, and events that classes can implement. Interfaces allow you to define features as small groups of closely related properties, methods, and events; this reduces compatibility problems.  You can add new features at any time by developing additional interfaces and implementations.
  翻译: