SlideShare a Scribd company logo
Basics of Object Oriented
Programming
Dr.A.Martin, ME, Ph.D.
Assistant Professor,
Dept. of Computer Science,
School of Mathematics and Computer Sciences,
Central University of Tamil Nadu,
Thiruvarur, Tamilnadu-610 101.
Agenda
• Structured Programming
• Limitations in Structured Programming
• Object Oriented Programming
• Classes and Objects
• OOP’s Principles
• Static and Non Static Data
• Accessibility
• Exception Handling and Templates
Structured Programming
• It employs a top-down design model - map
out the overall program structure into
separate subsections.
• A defined function or set of similar functions
is coded in a separate module or sub module.
• Most famous for removing or reducing flaws
on the GOTO statement.
• E.g. C – The Programming Language.
Limitations in structured programming
• Data hiding
• Debugging of programs are hard
– Not Possible to handle run time errors and future
enhancements.
• Non Flexibility of Code
– In procedural programming, parts of code are
interdependent.
– This interdependency makes modification &
manipulation of a particular part of the program
without affecting other parts.
Limitations in structured programming
• Software development period is high.
• Software cost is high.
• If end user requirement changes a big
modification is needed in software
• More stress laid on procedures not on data
Object Oriented Programming
• In object oriented programming data and the
instruction for processing that data are
combined into a self-sufficient “object” that
can be used in other programs.
• It is a programming methodology used to
solve and develop complex problems by using
oops principles.
• Real world objects
• Software Objects
• Mapping of Real objects to software objects.
Class and Objects
• A Vehicle – A Car
• Mechanism – Break System, Radiator Cooling
System, Auto Door Lock, Air Conditioning, Safety
System, Security Mechanism, Gear Mechanism,
etc.,
• Spare Parts - Tires, Number of Tires, Head Light,
Density of air in tiers, Switch, window, door,
Number of windows and doors, Number of
seats.
• Car created with mechanism and spare parts.
• So many types – all from same car – differs in
flexibility and luxuries.
• Class – The bundling of data and functions
that acting on data on a single place.
• Class is a mould upon which objects are
created.
• The logical thing class is invoked by the real
thing object.
• The instance of the class is object.
OOPs Principles,
Encapsulation
Inheritance
Polymorphism
Data abstraction
Encapsulation – A rigid wall
• The binding of data and functions together to
achieve information hiding and modularity.
• Not allowed to enter.
• Not same kind of restriction to everyone.
• We want to some level of flexibility.
• Accessibility – access specifiers
• Public , Private and Protected
• Default.
Inheritance
 It allows the creation of hierarchical classifications.
 Using inheritance, you can create a general class that
defines common properties.
 This class may then inherit by more specific classes,
each adding only those things that are unique to the
inheriting class.
 The process of creating new classes from existing
classes.
 A class that inherited is referred to as a base class.
 The class that does the inheriting is called derived
class.
Benefits,
 New classes can be derived by the user
from the existing classes without any
modification.
 It saves time and money.
 It reduces program coding time.
 It increases the reliability of the program.
Types of Inheritance
 Single : one base class and derived class
 Multiple : Many base class to one derived
class
 Multilevel : derived classes in a sequential
order
 Hierarchical : one base class and many
derived class
 Hybrid : A class derived from a base class
and an inheritance class
Polymorphism
• One interface with different forms
• Moving of a vehicle – Energy required.
• Energy available in different forms
• Fuel – Petrol, Diesel, Solar, Electric – Battery.
• Objective – Moving – achieved with different
ways.
• Compile time polymorphism and Run time
polymorphism.
Compile time polymorphism and Run time
polymorphism.
• Function overloading
 Same function with different arguments
Sum(int a ,int b)
Sum (double a, double b)
Sum (double a, double b, double c)
Sum (int a, long b)
 Need not worry about return type.
Function overriding
• Both base class and sub class have the
identical function.
• Same name, same number of arguments,
same data type.
• The function which is available in derived class
overrides the function in base class – called as
function overriding.
Static and Non Static Data
• Single copy shared by all instances
• Individual copy for every object
• How objects created for a class.
• How memory is allocated and reclaimed for
objects.
• Garbage collection.
• Constructor and Destructor. [C++]
• Constructor and Garbage Thread [Java].
Accessibility Levels
• Public, Private and Protected. [C++]
• Public, Private and Protected and default.
[Java]
this pointer
• Avoids name collision
• Refers the current object
Templates
• Templates are mechanism that make it
possible to use one function or class to handle
different data types.
• Function Template
• Class Template

More Related Content

Similar to Basics of object oriented programming interview tips for Java (20)

SKILLWISE - OOPS CONCEPT
SKILLWISE - OOPS CONCEPTSKILLWISE - OOPS CONCEPT
SKILLWISE - OOPS CONCEPT
Skillwise Group
 
Cs2305 programming paradigms lecturer notes
Cs2305   programming paradigms lecturer notesCs2305   programming paradigms lecturer notes
Cs2305 programming paradigms lecturer notes
Saravanakumar viswanathan
 
1unit-120324103142-phpapp02.pdf
1unit-120324103142-phpapp02.pdf1unit-120324103142-phpapp02.pdf
1unit-120324103142-phpapp02.pdf
SahajShrimal1
 
8 oo approach&uml-23_feb
8 oo approach&uml-23_feb8 oo approach&uml-23_feb
8 oo approach&uml-23_feb
Raj Shah
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
baabtra.com - No. 1 supplier of quality freshers
 
Principles and advantages of oop ppt
Principles and advantages of oop pptPrinciples and advantages of oop ppt
Principles and advantages of oop ppt
daxesh chauhan
 
Introduction to OOP concepts
Introduction to OOP conceptsIntroduction to OOP concepts
Introduction to OOP concepts
Ahmed Farag
 
UNIT1- OBJECT ORIENTED PROGRAMMING IN JAVA- AIML IT-SPPU
UNIT1- OBJECT ORIENTED PROGRAMMING IN JAVA- AIML IT-SPPUUNIT1- OBJECT ORIENTED PROGRAMMING IN JAVA- AIML IT-SPPU
UNIT1- OBJECT ORIENTED PROGRAMMING IN JAVA- AIML IT-SPPU
ApurvaLaddha
 
Data structures and algorithms Module-1.pdf
Data structures and algorithms Module-1.pdfData structures and algorithms Module-1.pdf
Data structures and algorithms Module-1.pdf
DukeCalvin
 
1 unit (oops)
1 unit (oops)1 unit (oops)
1 unit (oops)
Jay Patel
 
Basic concepts of oops
Basic concepts of oopsBasic concepts of oops
Basic concepts of oops
Chandrakiran Satdeve
 
Need of object oriented programming
Need of object oriented programmingNeed of object oriented programming
Need of object oriented programming
Amar Jukuntla
 
Unit 2.pptx
Unit 2.pptxUnit 2.pptx
Unit 2.pptx
SherinRappai
 
Unit 2.pptx
Unit 2.pptxUnit 2.pptx
Unit 2.pptx
SherinRappai1
 
Deep Learning For Practitioners, lecture 2: Selecting the right applications...
Deep Learning For Practitioners,  lecture 2: Selecting the right applications...Deep Learning For Practitioners,  lecture 2: Selecting the right applications...
Deep Learning For Practitioners, lecture 2: Selecting the right applications...
ananth
 
OOPsConceptspythonenineeringcomputerscienceand engineering.pptx
OOPsConceptspythonenineeringcomputerscienceand engineering.pptxOOPsConceptspythonenineeringcomputerscienceand engineering.pptx
OOPsConceptspythonenineeringcomputerscienceand engineering.pptx
PraharikaCh
 
Intro to Data Structure & Algorithms
Intro to Data Structure & AlgorithmsIntro to Data Structure & Algorithms
Intro to Data Structure & Algorithms
Akhil Kaushik
 
Object Oriented Programming (OOP) Introduction
Object Oriented Programming (OOP) IntroductionObject Oriented Programming (OOP) Introduction
Object Oriented Programming (OOP) Introduction
SamuelAnsong6
 
PPL, OQL & oodbms
PPL, OQL & oodbmsPPL, OQL & oodbms
PPL, OQL & oodbms
ramandeep brar
 
Introduction to Software - Coder Forge - John Mulhall
Introduction to Software - Coder Forge - John MulhallIntroduction to Software - Coder Forge - John Mulhall
Introduction to Software - Coder Forge - John Mulhall
John Mulhall
 
SKILLWISE - OOPS CONCEPT
SKILLWISE - OOPS CONCEPTSKILLWISE - OOPS CONCEPT
SKILLWISE - OOPS CONCEPT
Skillwise Group
 
1unit-120324103142-phpapp02.pdf
1unit-120324103142-phpapp02.pdf1unit-120324103142-phpapp02.pdf
1unit-120324103142-phpapp02.pdf
SahajShrimal1
 
8 oo approach&uml-23_feb
8 oo approach&uml-23_feb8 oo approach&uml-23_feb
8 oo approach&uml-23_feb
Raj Shah
 
Principles and advantages of oop ppt
Principles and advantages of oop pptPrinciples and advantages of oop ppt
Principles and advantages of oop ppt
daxesh chauhan
 
Introduction to OOP concepts
Introduction to OOP conceptsIntroduction to OOP concepts
Introduction to OOP concepts
Ahmed Farag
 
UNIT1- OBJECT ORIENTED PROGRAMMING IN JAVA- AIML IT-SPPU
UNIT1- OBJECT ORIENTED PROGRAMMING IN JAVA- AIML IT-SPPUUNIT1- OBJECT ORIENTED PROGRAMMING IN JAVA- AIML IT-SPPU
UNIT1- OBJECT ORIENTED PROGRAMMING IN JAVA- AIML IT-SPPU
ApurvaLaddha
 
Data structures and algorithms Module-1.pdf
Data structures and algorithms Module-1.pdfData structures and algorithms Module-1.pdf
Data structures and algorithms Module-1.pdf
DukeCalvin
 
1 unit (oops)
1 unit (oops)1 unit (oops)
1 unit (oops)
Jay Patel
 
Need of object oriented programming
Need of object oriented programmingNeed of object oriented programming
Need of object oriented programming
Amar Jukuntla
 
Deep Learning For Practitioners, lecture 2: Selecting the right applications...
Deep Learning For Practitioners,  lecture 2: Selecting the right applications...Deep Learning For Practitioners,  lecture 2: Selecting the right applications...
Deep Learning For Practitioners, lecture 2: Selecting the right applications...
ananth
 
OOPsConceptspythonenineeringcomputerscienceand engineering.pptx
OOPsConceptspythonenineeringcomputerscienceand engineering.pptxOOPsConceptspythonenineeringcomputerscienceand engineering.pptx
OOPsConceptspythonenineeringcomputerscienceand engineering.pptx
PraharikaCh
 
Intro to Data Structure & Algorithms
Intro to Data Structure & AlgorithmsIntro to Data Structure & Algorithms
Intro to Data Structure & Algorithms
Akhil Kaushik
 
Object Oriented Programming (OOP) Introduction
Object Oriented Programming (OOP) IntroductionObject Oriented Programming (OOP) Introduction
Object Oriented Programming (OOP) Introduction
SamuelAnsong6
 
Introduction to Software - Coder Forge - John Mulhall
Introduction to Software - Coder Forge - John MulhallIntroduction to Software - Coder Forge - John Mulhall
Introduction to Software - Coder Forge - John Mulhall
John Mulhall
 

Recently uploaded (20)

Key AI Technologies Used by Indian Artificial Intelligence Companies
Key AI Technologies Used by Indian Artificial Intelligence CompaniesKey AI Technologies Used by Indian Artificial Intelligence Companies
Key AI Technologies Used by Indian Artificial Intelligence Companies
Mypcot Infotech
 
FME for Climate Data: Turning Big Data into Actionable Insights
FME for Climate Data: Turning Big Data into Actionable InsightsFME for Climate Data: Turning Big Data into Actionable Insights
FME for Climate Data: Turning Big Data into Actionable Insights
Safe Software
 
Code and No-Code Journeys: The Coverage Overlook
Code and No-Code Journeys: The Coverage OverlookCode and No-Code Journeys: The Coverage Overlook
Code and No-Code Journeys: The Coverage Overlook
Applitools
 
Marketo & Dynamics can be Most Excellent to Each Other – The Sequel
Marketo & Dynamics can be Most Excellent to Each Other – The SequelMarketo & Dynamics can be Most Excellent to Each Other – The Sequel
Marketo & Dynamics can be Most Excellent to Each Other – The Sequel
BradBedford3
 
IBM Rational Unified Process For Software Engineering - Introduction
IBM Rational Unified Process For Software Engineering - IntroductionIBM Rational Unified Process For Software Engineering - Introduction
IBM Rational Unified Process For Software Engineering - Introduction
Gaurav Sharma
 
Shell Skill Tree - LabEx Certification (LabEx)
Shell Skill Tree - LabEx Certification (LabEx)Shell Skill Tree - LabEx Certification (LabEx)
Shell Skill Tree - LabEx Certification (LabEx)
VICTOR MAESTRE RAMIREZ
 
Who will create the languages of the future?
Who will create the languages of the future?Who will create the languages of the future?
Who will create the languages of the future?
Jordi Cabot
 
Essentials of Resource Planning in a Downturn
Essentials of Resource Planning in a DownturnEssentials of Resource Planning in a Downturn
Essentials of Resource Planning in a Downturn
OnePlan Solutions
 
Bonk coin airdrop_ Everything You Need to Know.pdf
Bonk coin airdrop_ Everything You Need to Know.pdfBonk coin airdrop_ Everything You Need to Know.pdf
Bonk coin airdrop_ Everything You Need to Know.pdf
Herond Labs
 
OpenTelemetry 101 Cloud Native Barcelona
OpenTelemetry 101 Cloud Native BarcelonaOpenTelemetry 101 Cloud Native Barcelona
OpenTelemetry 101 Cloud Native Barcelona
Imma Valls Bernaus
 
Integrating Survey123 and R&H Data Using FME
Integrating Survey123 and R&H Data Using FMEIntegrating Survey123 and R&H Data Using FME
Integrating Survey123 and R&H Data Using FME
Safe Software
 
Integration Ignited Redefining Event-Driven Architecture at Wix - EventCentric
Integration Ignited Redefining Event-Driven Architecture at Wix - EventCentricIntegration Ignited Redefining Event-Driven Architecture at Wix - EventCentric
Integration Ignited Redefining Event-Driven Architecture at Wix - EventCentric
Natan Silnitsky
 
IMAGE CLASSIFICATION USING CONVOLUTIONAL NEURAL NETWORK.P.pptx
IMAGE CLASSIFICATION USING CONVOLUTIONAL NEURAL NETWORK.P.pptxIMAGE CLASSIFICATION USING CONVOLUTIONAL NEURAL NETWORK.P.pptx
IMAGE CLASSIFICATION USING CONVOLUTIONAL NEURAL NETWORK.P.pptx
usmanch7829
 
Migrating to Azure Cosmos DB the Right Way
Migrating to Azure Cosmos DB the Right WayMigrating to Azure Cosmos DB the Right Way
Migrating to Azure Cosmos DB the Right Way
Alexander (Alex) Komyagin
 
How Insurance Policy Administration Streamlines Policy Lifecycle for Agile Op...
How Insurance Policy Administration Streamlines Policy Lifecycle for Agile Op...How Insurance Policy Administration Streamlines Policy Lifecycle for Agile Op...
How Insurance Policy Administration Streamlines Policy Lifecycle for Agile Op...
Insurance Tech Services
 
Software Testing & it’s types (DevOps)
Software  Testing & it’s  types (DevOps)Software  Testing & it’s  types (DevOps)
Software Testing & it’s types (DevOps)
S Pranav (Deepu)
 
Async-ronizing Success at Wix - Patterns for Seamless Microservices - Devoxx ...
Async-ronizing Success at Wix - Patterns for Seamless Microservices - Devoxx ...Async-ronizing Success at Wix - Patterns for Seamless Microservices - Devoxx ...
Async-ronizing Success at Wix - Patterns for Seamless Microservices - Devoxx ...
Natan Silnitsky
 
Top 5 Task Management Software to Boost Productivity in 2025
Top 5 Task Management Software to Boost Productivity in 2025Top 5 Task Management Software to Boost Productivity in 2025
Top 5 Task Management Software to Boost Productivity in 2025
Orangescrum
 
Generative Artificial Intelligence and its Applications
Generative Artificial Intelligence and its ApplicationsGenerative Artificial Intelligence and its Applications
Generative Artificial Intelligence and its Applications
SandeepKS52
 
Agentic Techniques in Retrieval-Augmented Generation with Azure AI Search
Agentic Techniques in Retrieval-Augmented Generation with Azure AI SearchAgentic Techniques in Retrieval-Augmented Generation with Azure AI Search
Agentic Techniques in Retrieval-Augmented Generation with Azure AI Search
Maxim Salnikov
 
Key AI Technologies Used by Indian Artificial Intelligence Companies
Key AI Technologies Used by Indian Artificial Intelligence CompaniesKey AI Technologies Used by Indian Artificial Intelligence Companies
Key AI Technologies Used by Indian Artificial Intelligence Companies
Mypcot Infotech
 
FME for Climate Data: Turning Big Data into Actionable Insights
FME for Climate Data: Turning Big Data into Actionable InsightsFME for Climate Data: Turning Big Data into Actionable Insights
FME for Climate Data: Turning Big Data into Actionable Insights
Safe Software
 
Code and No-Code Journeys: The Coverage Overlook
Code and No-Code Journeys: The Coverage OverlookCode and No-Code Journeys: The Coverage Overlook
Code and No-Code Journeys: The Coverage Overlook
Applitools
 
Marketo & Dynamics can be Most Excellent to Each Other – The Sequel
Marketo & Dynamics can be Most Excellent to Each Other – The SequelMarketo & Dynamics can be Most Excellent to Each Other – The Sequel
Marketo & Dynamics can be Most Excellent to Each Other – The Sequel
BradBedford3
 
IBM Rational Unified Process For Software Engineering - Introduction
IBM Rational Unified Process For Software Engineering - IntroductionIBM Rational Unified Process For Software Engineering - Introduction
IBM Rational Unified Process For Software Engineering - Introduction
Gaurav Sharma
 
Shell Skill Tree - LabEx Certification (LabEx)
Shell Skill Tree - LabEx Certification (LabEx)Shell Skill Tree - LabEx Certification (LabEx)
Shell Skill Tree - LabEx Certification (LabEx)
VICTOR MAESTRE RAMIREZ
 
Who will create the languages of the future?
Who will create the languages of the future?Who will create the languages of the future?
Who will create the languages of the future?
Jordi Cabot
 
Essentials of Resource Planning in a Downturn
Essentials of Resource Planning in a DownturnEssentials of Resource Planning in a Downturn
Essentials of Resource Planning in a Downturn
OnePlan Solutions
 
Bonk coin airdrop_ Everything You Need to Know.pdf
Bonk coin airdrop_ Everything You Need to Know.pdfBonk coin airdrop_ Everything You Need to Know.pdf
Bonk coin airdrop_ Everything You Need to Know.pdf
Herond Labs
 
OpenTelemetry 101 Cloud Native Barcelona
OpenTelemetry 101 Cloud Native BarcelonaOpenTelemetry 101 Cloud Native Barcelona
OpenTelemetry 101 Cloud Native Barcelona
Imma Valls Bernaus
 
Integrating Survey123 and R&H Data Using FME
Integrating Survey123 and R&H Data Using FMEIntegrating Survey123 and R&H Data Using FME
Integrating Survey123 and R&H Data Using FME
Safe Software
 
Integration Ignited Redefining Event-Driven Architecture at Wix - EventCentric
Integration Ignited Redefining Event-Driven Architecture at Wix - EventCentricIntegration Ignited Redefining Event-Driven Architecture at Wix - EventCentric
Integration Ignited Redefining Event-Driven Architecture at Wix - EventCentric
Natan Silnitsky
 
IMAGE CLASSIFICATION USING CONVOLUTIONAL NEURAL NETWORK.P.pptx
IMAGE CLASSIFICATION USING CONVOLUTIONAL NEURAL NETWORK.P.pptxIMAGE CLASSIFICATION USING CONVOLUTIONAL NEURAL NETWORK.P.pptx
IMAGE CLASSIFICATION USING CONVOLUTIONAL NEURAL NETWORK.P.pptx
usmanch7829
 
How Insurance Policy Administration Streamlines Policy Lifecycle for Agile Op...
How Insurance Policy Administration Streamlines Policy Lifecycle for Agile Op...How Insurance Policy Administration Streamlines Policy Lifecycle for Agile Op...
How Insurance Policy Administration Streamlines Policy Lifecycle for Agile Op...
Insurance Tech Services
 
Software Testing & it’s types (DevOps)
Software  Testing & it’s  types (DevOps)Software  Testing & it’s  types (DevOps)
Software Testing & it’s types (DevOps)
S Pranav (Deepu)
 
Async-ronizing Success at Wix - Patterns for Seamless Microservices - Devoxx ...
Async-ronizing Success at Wix - Patterns for Seamless Microservices - Devoxx ...Async-ronizing Success at Wix - Patterns for Seamless Microservices - Devoxx ...
Async-ronizing Success at Wix - Patterns for Seamless Microservices - Devoxx ...
Natan Silnitsky
 
Top 5 Task Management Software to Boost Productivity in 2025
Top 5 Task Management Software to Boost Productivity in 2025Top 5 Task Management Software to Boost Productivity in 2025
Top 5 Task Management Software to Boost Productivity in 2025
Orangescrum
 
Generative Artificial Intelligence and its Applications
Generative Artificial Intelligence and its ApplicationsGenerative Artificial Intelligence and its Applications
Generative Artificial Intelligence and its Applications
SandeepKS52
 
Agentic Techniques in Retrieval-Augmented Generation with Azure AI Search
Agentic Techniques in Retrieval-Augmented Generation with Azure AI SearchAgentic Techniques in Retrieval-Augmented Generation with Azure AI Search
Agentic Techniques in Retrieval-Augmented Generation with Azure AI Search
Maxim Salnikov
 
Ad

Basics of object oriented programming interview tips for Java

  • 1. Basics of Object Oriented Programming Dr.A.Martin, ME, Ph.D. Assistant Professor, Dept. of Computer Science, School of Mathematics and Computer Sciences, Central University of Tamil Nadu, Thiruvarur, Tamilnadu-610 101.
  • 2. Agenda • Structured Programming • Limitations in Structured Programming • Object Oriented Programming • Classes and Objects • OOP’s Principles • Static and Non Static Data • Accessibility • Exception Handling and Templates
  • 3. Structured Programming • It employs a top-down design model - map out the overall program structure into separate subsections. • A defined function or set of similar functions is coded in a separate module or sub module. • Most famous for removing or reducing flaws on the GOTO statement. • E.g. C – The Programming Language.
  • 4. Limitations in structured programming • Data hiding • Debugging of programs are hard – Not Possible to handle run time errors and future enhancements. • Non Flexibility of Code – In procedural programming, parts of code are interdependent. – This interdependency makes modification & manipulation of a particular part of the program without affecting other parts.
  • 5. Limitations in structured programming • Software development period is high. • Software cost is high. • If end user requirement changes a big modification is needed in software • More stress laid on procedures not on data
  • 6. Object Oriented Programming • In object oriented programming data and the instruction for processing that data are combined into a self-sufficient “object” that can be used in other programs. • It is a programming methodology used to solve and develop complex problems by using oops principles. • Real world objects • Software Objects • Mapping of Real objects to software objects.
  • 7. Class and Objects • A Vehicle – A Car • Mechanism – Break System, Radiator Cooling System, Auto Door Lock, Air Conditioning, Safety System, Security Mechanism, Gear Mechanism, etc., • Spare Parts - Tires, Number of Tires, Head Light, Density of air in tiers, Switch, window, door, Number of windows and doors, Number of seats. • Car created with mechanism and spare parts. • So many types – all from same car – differs in flexibility and luxuries.
  • 8. • Class – The bundling of data and functions that acting on data on a single place. • Class is a mould upon which objects are created. • The logical thing class is invoked by the real thing object. • The instance of the class is object.
  • 10. Encapsulation – A rigid wall • The binding of data and functions together to achieve information hiding and modularity. • Not allowed to enter. • Not same kind of restriction to everyone. • We want to some level of flexibility. • Accessibility – access specifiers • Public , Private and Protected • Default.
  • 11. Inheritance  It allows the creation of hierarchical classifications.  Using inheritance, you can create a general class that defines common properties.  This class may then inherit by more specific classes, each adding only those things that are unique to the inheriting class.  The process of creating new classes from existing classes.  A class that inherited is referred to as a base class.  The class that does the inheriting is called derived class.
  • 12. Benefits,  New classes can be derived by the user from the existing classes without any modification.  It saves time and money.  It reduces program coding time.  It increases the reliability of the program.
  • 13. Types of Inheritance  Single : one base class and derived class  Multiple : Many base class to one derived class  Multilevel : derived classes in a sequential order  Hierarchical : one base class and many derived class  Hybrid : A class derived from a base class and an inheritance class
  • 14. Polymorphism • One interface with different forms • Moving of a vehicle – Energy required. • Energy available in different forms • Fuel – Petrol, Diesel, Solar, Electric – Battery. • Objective – Moving – achieved with different ways. • Compile time polymorphism and Run time polymorphism.
  • 15. Compile time polymorphism and Run time polymorphism. • Function overloading  Same function with different arguments Sum(int a ,int b) Sum (double a, double b) Sum (double a, double b, double c) Sum (int a, long b)  Need not worry about return type.
  • 16. Function overriding • Both base class and sub class have the identical function. • Same name, same number of arguments, same data type. • The function which is available in derived class overrides the function in base class – called as function overriding.
  • 17. Static and Non Static Data • Single copy shared by all instances • Individual copy for every object • How objects created for a class. • How memory is allocated and reclaimed for objects. • Garbage collection. • Constructor and Destructor. [C++] • Constructor and Garbage Thread [Java].
  • 18. Accessibility Levels • Public, Private and Protected. [C++] • Public, Private and Protected and default. [Java]
  • 19. this pointer • Avoids name collision • Refers the current object
  • 20. Templates • Templates are mechanism that make it possible to use one function or class to handle different data types. • Function Template • Class Template