SlideShare a Scribd company logo
1 of 20
Advanced Oops concept using
ASP.NET
By
Dr.R.Shenbagavalli
Index
A. Object Oriented Programming
1. Class
2.Constructor and Destructor
3.Inheritance
4.Overridden
5.Overloading
6.Polymorphism
7.Interfaces
8. Implementing Polymorphism using
Interfaces
B. Multithreaded Programming
1. Thread Synchronization
2. Events and Thread Synchronization
Polymorphism
• Different classes that have same properties
and methods
• Classes represent have similar operation and
characteristics
• Example
Vehicle - base class
each type of
vehicle derive from vehicle class
see eg in your book
• Class Truck inherits Vehicle
which contain procedure and function like
1.function start engine
2. stop engine
3.function accelerate
• Class minivan inherits vehicle
which also contain the same function and procedure in the same name
what truck has.
• Next create one object objvehicle through procedure (Dovehicleoperation)
to call all the function and procedure from both derived class(truck and
minivan)
• Create object for individual derived class
dim objtruck as new truck()
dim objminivan as new minivan()
• Execute individual derived class function and procedure by substituting
each derived class object in Dovehicleoperation procedure
Dovehicleoperation (objtruck)
Dovehicleoperation(objminivan)
From the previous example polymorphism is many form
like truck and minivan which has same name methods
and characteristics as base class
• Polymorphism provides following features:
• It allows you to invoke methods of derived class
through base class reference during runtime.
• It has the ability for classes to provide different
implementations of methods that are called through
the same name.
• Advantage of polymorphism:
• It helps programmers to reuse the code, classes,
methods written once, tested and implemented. They
may be reused in many ways. The single variable name
can be used to store variables of multiple data types
such as Int, Float, double, Long, etc).
Interfaces
• An interface is a specification for a set of class
members, properties, and methods but do
not provide any implementation.
An Interface is a reference type and it contains
only abstract members such as Events,
Methods, Properties etc. It contain only
declaration for its members and
implementation defined as separate entities
from classes.
• Create one interface imyclassinterface, which
contains procedure (myproc,yourproc) and
functions(anybodysproc)
• Create class cmyclass implements
imyclassinterface
The class contains the same procedure
and function what the interface has.but all the
class procedure and function should
implement through interface procedure
for eg
public sub myproc implements
imyclassinterface.myproc
• All the class procedure should implement
through interface procedure.
• Next Create object for both interface and
class. The class name for both of them are
same.
dim objmyclass as imyclassinterface
dim blnreturnvalue as boolean
objmyclass = new cmyclass()
Through the object we can call procedure and
functions within the class
• Objmyclass.myproc(1)
objmyclass.yourproc(“test”)
Blnretrnvalue =objmyclass.anybodyproc(1)
Here blnreturnvalue is a variable of type
imyclassinterface. So all the class procedure,
function and datatpe are called through the
implementation of an interface.
• We can also apply inheritance within an
interace
• Interface imyalternativeclassinterface inherits
imyclassinterface
One procedure (myaltsub) for derived interface
Create an object for derived interface with same
name objmyclass.
To call both interface procedure add both
interface within the class by
public class cmyclass implements
imyclassinterface, imyalternativeclassinterface
then objmyclass.myproc(1)
Objmyclass.myaltsub()……
Implementing Polymorphism using
Interfaces
• In an inheritance ,single class implements
different interfaces like
public class cmyclass implements
imyclassinterface, imyalternativeclassinterface
in the case of polymorphism two different
classes share an interface
Interface igameweapon which contain
property(numofrounds),function(fire) and
procedure(reload)
• Two classes
1. public class cmachinegun implements igameweapon
2. public class crocketlauncher implements igameweapon
Both class contains the same property,function and procedure what an
interface has.
• Next create object for interface through one procedure
reloadandattack .
• Next create object for both class .here the object name need not be
same as interface object.
dim objmachinegun as new cmachinegn()
dim objrocketlauncher as new crocketlauncher()
to call the procedure and function of each class through interface
object
• Reloadandattack(objmachinegun)
• Reloadandattack(objrocketlauncher)
Multithreaded programming
• Execution follows a single path called a thread.
• In a single threaded application the task like user
input, sorting the large datalist, sending the list to
some application are executed sequentially even
if they are independent task.
• A web server will not do a single threaded
application.it needs to handle thousands of
simultaneous request .
• The solution to maximize the hardware resources
to make the application multithreaded.In .net it is
called free-threaded.
• In .net the class object like
system.threading.thread will do threading function
For eg
take two thread
fnction(threadoneproc,threadtwoproc).each function print
out a message that identifies itself 200 times.
Next create object for each thread
dim thd1 as new system,threading.thread(Address of
threadoneproc)
dim thd2 as new system,threading.thread(Address of
threadtwoproc)
Execute both thread function by calling
thd1.start()
Thd2.start().here the start() function will execute both thread.
Thread synchronization
• In a free threaded application more than one
thread can occur simultaneously. One of the
problem with free threaded is able to
coordinate thread that operate on the same
set of data.coordinating thread is called
thread synchronization.
• Two methods are sed to synchronize threads
by using IsAlive()
• Two threads sort() and printlist()
• Create object for the class then create object
for both threads.
• Here isalive functionis used to check the first
thread is running or not .after completing
sort() ,the sorted list to be printed.
Events and thread Synchronization
• An event is a type of signal that we can attach with a class.
That signal can be activated when something happens
inside the class. The event then handled by the host.
• Event is a set of code defined within the class.
Eg public Event somethinghappened().
• Eg for raise event definition
RaiseEvent somethinghappened().
• Declaration of event within the class
dim withevents objmyclass as cmyclassthathasevents
event object classname
• In the eg program
two events has been defined
public event progress()
public event done()
And declared as
dim withevents objlist as cnumberlist
Event raise can be defined as
raiseevent progress can be written within the
sort program to check whether all 1500 numbers
have been sorted. If it is not ,again the loop will
be return back to progress
Raiseevent done() .this is another raise event will be
aised after the completion of sorting
• To execute event with synchronization
1. create object for thread to sort procedure either to
start the procedure or stop the procedure
thdsortthread.start()
thdsortthread.abort()
2. write procedre for both events with handles
public sub objlist_progress () handles objlist.progress
this procedure is to display how much % of sorting
has been completed.
public sub objlist_done() handles objlist.done()
this procedure is to take printout.since done means the
sorting is over
• Students please study this portion which I
have not covered in the class. Other portion I
have covered in the class itself. Go through the
entire syllabus. Study well . Stay at home
safely. Complete the record work . Do practice
your Lab exercises.
Wish you all the Best

More Related Content

What's hot

An introduction to constructor
An introduction to constructorAn introduction to constructor
An introduction to constructorNiby Babu
 
Using Combine, SwiftUI and callAsFunction to build an experimental localizati...
Using Combine, SwiftUI and callAsFunction to build an experimental localizati...Using Combine, SwiftUI and callAsFunction to build an experimental localizati...
Using Combine, SwiftUI and callAsFunction to build an experimental localizati...Donny Wals
 
Finalize() method
Finalize() methodFinalize() method
Finalize() methodJadavsejal
 
ConsTRUCTION AND DESTRUCTION
ConsTRUCTION AND DESTRUCTIONConsTRUCTION AND DESTRUCTION
ConsTRUCTION AND DESTRUCTIONShweta Shah
 
JavaScript Beyond jQuery
JavaScript Beyond jQueryJavaScript Beyond jQuery
JavaScript Beyond jQueryBobby Bryant
 
Operator Overloading
Operator OverloadingOperator Overloading
Operator OverloadingNilesh Dalvi
 
ARTDM 170, Week 5: Intro To Flash
ARTDM 170, Week 5: Intro To FlashARTDM 170, Week 5: Intro To Flash
ARTDM 170, Week 5: Intro To FlashGilbert Guerrero
 
Android development training programme , Day 3
Android development training programme , Day 3Android development training programme , Day 3
Android development training programme , Day 3DHIRAJ PRAVIN
 
Chapter 1 Presentation
Chapter 1 PresentationChapter 1 Presentation
Chapter 1 Presentationguest0d6229
 
Object Lifetime In C C++
Object Lifetime In C C++Object Lifetime In C C++
Object Lifetime In C C++ppd1961
 
Nodejs functions & modules
Nodejs functions & modulesNodejs functions & modules
Nodejs functions & modulesmonikadeshmane
 

What's hot (20)

An introduction to constructor
An introduction to constructorAn introduction to constructor
An introduction to constructor
 
Lesson3
Lesson3Lesson3
Lesson3
 
Using Combine, SwiftUI and callAsFunction to build an experimental localizati...
Using Combine, SwiftUI and callAsFunction to build an experimental localizati...Using Combine, SwiftUI and callAsFunction to build an experimental localizati...
Using Combine, SwiftUI and callAsFunction to build an experimental localizati...
 
Finalize() method
Finalize() methodFinalize() method
Finalize() method
 
ConsTRUCTION AND DESTRUCTION
ConsTRUCTION AND DESTRUCTIONConsTRUCTION AND DESTRUCTION
ConsTRUCTION AND DESTRUCTION
 
Dynamic databinding
Dynamic databindingDynamic databinding
Dynamic databinding
 
Mule java part-4
Mule java part-4Mule java part-4
Mule java part-4
 
Mule java part-3
Mule java part-3Mule java part-3
Mule java part-3
 
JavaScript Beyond jQuery
JavaScript Beyond jQueryJavaScript Beyond jQuery
JavaScript Beyond jQuery
 
Operator Overloading
Operator OverloadingOperator Overloading
Operator Overloading
 
ARTDM 170, Week 5: Intro To Flash
ARTDM 170, Week 5: Intro To FlashARTDM 170, Week 5: Intro To Flash
ARTDM 170, Week 5: Intro To Flash
 
Android development training programme , Day 3
Android development training programme , Day 3Android development training programme , Day 3
Android development training programme , Day 3
 
Obj 3
Obj 3Obj 3
Obj 3
 
Objective-C: Good and Bad
Objective-C: Good and BadObjective-C: Good and Bad
Objective-C: Good and Bad
 
Chapter 1 Presentation
Chapter 1 PresentationChapter 1 Presentation
Chapter 1 Presentation
 
Sep 15
Sep 15Sep 15
Sep 15
 
Sep 15
Sep 15Sep 15
Sep 15
 
Method overloading
Method overloadingMethod overloading
Method overloading
 
Object Lifetime In C C++
Object Lifetime In C C++Object Lifetime In C C++
Object Lifetime In C C++
 
Nodejs functions & modules
Nodejs functions & modulesNodejs functions & modules
Nodejs functions & modules
 

Similar to Advanced OOPS Concepts in ASP.NET

Java 102 intro to object-oriented programming in java
Java 102   intro to object-oriented programming in javaJava 102   intro to object-oriented programming in java
Java 102 intro to object-oriented programming in javaagorolabs
 
Presentation 1st
Presentation 1stPresentation 1st
Presentation 1stConnex
 
Advanced java jee material by KV Rao sir
Advanced java jee material by KV Rao sirAdvanced java jee material by KV Rao sir
Advanced java jee material by KV Rao sirAVINASH KUMAR
 
Presentation 4th
Presentation 4thPresentation 4th
Presentation 4thConnex
 
object oriented programming language.pptx
object oriented programming language.pptxobject oriented programming language.pptx
object oriented programming language.pptxsyedabbas594247
 
Java basic part 2 : Datatypes Keywords Features Components Security Exceptions
Java basic part 2 : Datatypes Keywords Features Components Security Exceptions Java basic part 2 : Datatypes Keywords Features Components Security Exceptions
Java basic part 2 : Datatypes Keywords Features Components Security Exceptions Soumen Santra
 
Polymorphism Using C++
Polymorphism Using C++Polymorphism Using C++
Polymorphism Using C++PRINCE KUMAR
 
Intro To C++ - Class 05 - Introduction To Classes, Objects, & Strings
Intro To C++ - Class 05 - Introduction To  Classes, Objects, & StringsIntro To C++ - Class 05 - Introduction To  Classes, Objects, & Strings
Intro To C++ - Class 05 - Introduction To Classes, Objects, & StringsBlue Elephant Consulting
 
ITT 202 PRINCIPLES OF OBJECT ORIENTED TECHNIQUE
ITT 202 PRINCIPLES OF OBJECT ORIENTED TECHNIQUEITT 202 PRINCIPLES OF OBJECT ORIENTED TECHNIQUE
ITT 202 PRINCIPLES OF OBJECT ORIENTED TECHNIQUEVinishA23
 
Md02 - Getting Started part-2
Md02 - Getting Started part-2Md02 - Getting Started part-2
Md02 - Getting Started part-2Rakesh Madugula
 
The Ring programming language version 1.2 book - Part 5 of 84
The Ring programming language version 1.2 book - Part 5 of 84The Ring programming language version 1.2 book - Part 5 of 84
The Ring programming language version 1.2 book - Part 5 of 84Mahmoud Samir Fayed
 
Java For beginners and CSIT and IT students
Java  For beginners and CSIT and IT studentsJava  For beginners and CSIT and IT students
Java For beginners and CSIT and IT studentsPartnered Health
 
Java-Intro.pptx
Java-Intro.pptxJava-Intro.pptx
Java-Intro.pptxVijalJain3
 
Advance java kvr -satya
Advance java  kvr -satyaAdvance java  kvr -satya
Advance java kvr -satyaSatya Johnny
 

Similar to Advanced OOPS Concepts in ASP.NET (20)

Java 102 intro to object-oriented programming in java
Java 102   intro to object-oriented programming in javaJava 102   intro to object-oriented programming in java
Java 102 intro to object-oriented programming in java
 
Presentation 1st
Presentation 1stPresentation 1st
Presentation 1st
 
Advanced java jee material by KV Rao sir
Advanced java jee material by KV Rao sirAdvanced java jee material by KV Rao sir
Advanced java jee material by KV Rao sir
 
[2015/2016] JavaScript
[2015/2016] JavaScript[2015/2016] JavaScript
[2015/2016] JavaScript
 
Presentation 4th
Presentation 4thPresentation 4th
Presentation 4th
 
object oriented programming language.pptx
object oriented programming language.pptxobject oriented programming language.pptx
object oriented programming language.pptx
 
JavaScript
JavaScriptJavaScript
JavaScript
 
Java basic part 2 : Datatypes Keywords Features Components Security Exceptions
Java basic part 2 : Datatypes Keywords Features Components Security Exceptions Java basic part 2 : Datatypes Keywords Features Components Security Exceptions
Java basic part 2 : Datatypes Keywords Features Components Security Exceptions
 
Polymorphism Using C++
Polymorphism Using C++Polymorphism Using C++
Polymorphism Using C++
 
Java notes
Java notesJava notes
Java notes
 
Intro To C++ - Class 05 - Introduction To Classes, Objects, & Strings
Intro To C++ - Class 05 - Introduction To  Classes, Objects, & StringsIntro To C++ - Class 05 - Introduction To  Classes, Objects, & Strings
Intro To C++ - Class 05 - Introduction To Classes, Objects, & Strings
 
ITT 202 PRINCIPLES OF OBJECT ORIENTED TECHNIQUE
ITT 202 PRINCIPLES OF OBJECT ORIENTED TECHNIQUEITT 202 PRINCIPLES OF OBJECT ORIENTED TECHNIQUE
ITT 202 PRINCIPLES OF OBJECT ORIENTED TECHNIQUE
 
Md02 - Getting Started part-2
Md02 - Getting Started part-2Md02 - Getting Started part-2
Md02 - Getting Started part-2
 
The Ring programming language version 1.2 book - Part 5 of 84
The Ring programming language version 1.2 book - Part 5 of 84The Ring programming language version 1.2 book - Part 5 of 84
The Ring programming language version 1.2 book - Part 5 of 84
 
Vb.net iv
Vb.net ivVb.net iv
Vb.net iv
 
Java For beginners and CSIT and IT students
Java  For beginners and CSIT and IT studentsJava  For beginners and CSIT and IT students
Java For beginners and CSIT and IT students
 
Python oop class 1
Python oop   class 1Python oop   class 1
Python oop class 1
 
Java-Intro.pptx
Java-Intro.pptxJava-Intro.pptx
Java-Intro.pptx
 
Adv kvr -satya
Adv  kvr -satyaAdv  kvr -satya
Adv kvr -satya
 
Advance java kvr -satya
Advance java  kvr -satyaAdvance java  kvr -satya
Advance java kvr -satya
 

Recently uploaded

Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfadityarao40181
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
Blooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxBlooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxUnboundStockton
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,Virag Sontakke
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxRaymartEstabillo3
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting DataJhengPantaleon
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfMahmoud M. Sallam
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaVirag Sontakke
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 

Recently uploaded (20)

TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdf
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
Blooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxBlooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docx
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdf
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of India
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 

Advanced OOPS Concepts in ASP.NET

  • 1. Advanced Oops concept using ASP.NET By Dr.R.Shenbagavalli
  • 2. Index A. Object Oriented Programming 1. Class 2.Constructor and Destructor 3.Inheritance 4.Overridden 5.Overloading 6.Polymorphism 7.Interfaces 8. Implementing Polymorphism using Interfaces B. Multithreaded Programming 1. Thread Synchronization 2. Events and Thread Synchronization
  • 3. Polymorphism • Different classes that have same properties and methods • Classes represent have similar operation and characteristics • Example Vehicle - base class each type of vehicle derive from vehicle class see eg in your book
  • 4. • Class Truck inherits Vehicle which contain procedure and function like 1.function start engine 2. stop engine 3.function accelerate • Class minivan inherits vehicle which also contain the same function and procedure in the same name what truck has. • Next create one object objvehicle through procedure (Dovehicleoperation) to call all the function and procedure from both derived class(truck and minivan) • Create object for individual derived class dim objtruck as new truck() dim objminivan as new minivan() • Execute individual derived class function and procedure by substituting each derived class object in Dovehicleoperation procedure Dovehicleoperation (objtruck) Dovehicleoperation(objminivan)
  • 5. From the previous example polymorphism is many form like truck and minivan which has same name methods and characteristics as base class • Polymorphism provides following features: • It allows you to invoke methods of derived class through base class reference during runtime. • It has the ability for classes to provide different implementations of methods that are called through the same name. • Advantage of polymorphism: • It helps programmers to reuse the code, classes, methods written once, tested and implemented. They may be reused in many ways. The single variable name can be used to store variables of multiple data types such as Int, Float, double, Long, etc).
  • 6. Interfaces • An interface is a specification for a set of class members, properties, and methods but do not provide any implementation. An Interface is a reference type and it contains only abstract members such as Events, Methods, Properties etc. It contain only declaration for its members and implementation defined as separate entities from classes.
  • 7. • Create one interface imyclassinterface, which contains procedure (myproc,yourproc) and functions(anybodysproc) • Create class cmyclass implements imyclassinterface The class contains the same procedure and function what the interface has.but all the class procedure and function should implement through interface procedure for eg public sub myproc implements imyclassinterface.myproc
  • 8. • All the class procedure should implement through interface procedure. • Next Create object for both interface and class. The class name for both of them are same. dim objmyclass as imyclassinterface dim blnreturnvalue as boolean objmyclass = new cmyclass() Through the object we can call procedure and functions within the class
  • 9. • Objmyclass.myproc(1) objmyclass.yourproc(“test”) Blnretrnvalue =objmyclass.anybodyproc(1) Here blnreturnvalue is a variable of type imyclassinterface. So all the class procedure, function and datatpe are called through the implementation of an interface. • We can also apply inheritance within an interace
  • 10. • Interface imyalternativeclassinterface inherits imyclassinterface One procedure (myaltsub) for derived interface Create an object for derived interface with same name objmyclass. To call both interface procedure add both interface within the class by public class cmyclass implements imyclassinterface, imyalternativeclassinterface then objmyclass.myproc(1) Objmyclass.myaltsub()……
  • 11. Implementing Polymorphism using Interfaces • In an inheritance ,single class implements different interfaces like public class cmyclass implements imyclassinterface, imyalternativeclassinterface in the case of polymorphism two different classes share an interface Interface igameweapon which contain property(numofrounds),function(fire) and procedure(reload)
  • 12. • Two classes 1. public class cmachinegun implements igameweapon 2. public class crocketlauncher implements igameweapon Both class contains the same property,function and procedure what an interface has. • Next create object for interface through one procedure reloadandattack . • Next create object for both class .here the object name need not be same as interface object. dim objmachinegun as new cmachinegn() dim objrocketlauncher as new crocketlauncher() to call the procedure and function of each class through interface object • Reloadandattack(objmachinegun) • Reloadandattack(objrocketlauncher)
  • 13. Multithreaded programming • Execution follows a single path called a thread. • In a single threaded application the task like user input, sorting the large datalist, sending the list to some application are executed sequentially even if they are independent task. • A web server will not do a single threaded application.it needs to handle thousands of simultaneous request . • The solution to maximize the hardware resources to make the application multithreaded.In .net it is called free-threaded.
  • 14. • In .net the class object like system.threading.thread will do threading function For eg take two thread fnction(threadoneproc,threadtwoproc).each function print out a message that identifies itself 200 times. Next create object for each thread dim thd1 as new system,threading.thread(Address of threadoneproc) dim thd2 as new system,threading.thread(Address of threadtwoproc) Execute both thread function by calling thd1.start() Thd2.start().here the start() function will execute both thread.
  • 15. Thread synchronization • In a free threaded application more than one thread can occur simultaneously. One of the problem with free threaded is able to coordinate thread that operate on the same set of data.coordinating thread is called thread synchronization. • Two methods are sed to synchronize threads by using IsAlive()
  • 16. • Two threads sort() and printlist() • Create object for the class then create object for both threads. • Here isalive functionis used to check the first thread is running or not .after completing sort() ,the sorted list to be printed.
  • 17. Events and thread Synchronization • An event is a type of signal that we can attach with a class. That signal can be activated when something happens inside the class. The event then handled by the host. • Event is a set of code defined within the class. Eg public Event somethinghappened(). • Eg for raise event definition RaiseEvent somethinghappened(). • Declaration of event within the class dim withevents objmyclass as cmyclassthathasevents event object classname
  • 18. • In the eg program two events has been defined public event progress() public event done() And declared as dim withevents objlist as cnumberlist Event raise can be defined as raiseevent progress can be written within the sort program to check whether all 1500 numbers have been sorted. If it is not ,again the loop will be return back to progress Raiseevent done() .this is another raise event will be aised after the completion of sorting
  • 19. • To execute event with synchronization 1. create object for thread to sort procedure either to start the procedure or stop the procedure thdsortthread.start() thdsortthread.abort() 2. write procedre for both events with handles public sub objlist_progress () handles objlist.progress this procedure is to display how much % of sorting has been completed. public sub objlist_done() handles objlist.done() this procedure is to take printout.since done means the sorting is over
  • 20. • Students please study this portion which I have not covered in the class. Other portion I have covered in the class itself. Go through the entire syllabus. Study well . Stay at home safely. Complete the record work . Do practice your Lab exercises. Wish you all the Best