SlideShare a Scribd company logo
1 of 21
Q1:Define Inheritance? Name various types of
Inheritance?
Inheritance is a feature or a process in which, new
classes are created from the existing classes. The
new class created is called “derived class” or “child
class” and the existing class is known as the “base
class” or “parent class”. The derived class now is
said to be inherited from the base class.
Q:-What pure virtual function?
 Pure virtual functions in C++ are virtual
functions with no definition. We use the
keyword “virtual” in C++ to declare a
virtual function. They are assigned a value
of zero when they are declared.
 Syntax:- virtual void f()=0;
Q:-What is data hiding?How it is
achieved in C++?
Data hiding is a technique of hiding
internal object details, i.e., data
members. It is an object-oriented
programming technique. Data
hiding ensures, or we can say
guarantees to restrict the data
access to class members. It
maintains data integrity.
 Example: We can understand data hiding
with an example. Suppose we declared an
Account class with a data member balance
inside it. Here, the account balance is
sensitive information. We may allow
someone to check the account balance but
won’t allow altering the balance attribute.
So, by declaring the balance attribute
private, we can restrict the access to
balance from an outside application.
It can be achieved by using private
and protected specificer
Q:-What is array of an object? Explain
an example?
In the array of object in C++, each element
of an array becomes an object (same
class’s), which means the array of object in
C++ is a collection of objects of the same
class. Just as an object is a collection of
data-members and function-members. so
each element of an array is a collection of
data-member and function-member.
Q:-What is function overoading? Give
example?
 Function overloading is a feature of object-
oriented programming where two or more
functions can have the same name but
different parameters. When a function name
is overloaded with different jobs it is called
Function Overloading. In Function
Overloading “Function” name should be the
same and the arguments should be
different.
Q:- What are the various data types
supported by C++?
 C++ supports a wide variety of data
types and the programmer can select
the data type appropriate to the needs
of the application. Data types specify
the size and types of value to be
stored.
 Data types in C++ are mainly divided into
three types:
 1. Primitive Data Types: These data types are
built-in or predefined data types and can be
used directly by the user to declare variables.
Primitive data types available in C++ are:
 int
 float
 char
 double
2.Derived Data Types: The data types that are
derived from the primitive or built-in datatypes
are referred to as Derived Data Types. These
can be of four types namely:
Function
Array
Pointer
Reference
 3.Abstract or User-Defined Data Types:
These data types are defined by the user
itself. Like, as defining a class in C++ or a
structure. C++ provides the following user-
defined datatypes:
 Class
 Structure
 Union
 Enumeration
 Typedef
Q1:-Compare public,private, protected
visibility modes ?
Public Access Modifier in C++All the
variables and functions declared under
the public access modifier will be
available for everyone. They can be
accessed both inside and outside the
class. Dot (.) operator is used in the
program to access public data members
directly.
Private access modifier
All the variables and functions declared
under a private access modifier can only
be used inside the class. They are not
permissible to be used by any object or
function outside the class.
Protected Access Modifiers
C++Protected access modifiers are
similar to the private access modifiers
but protected access modifiers can be
accessed in the derived class whereas
private access modifiers cannot be
accessed in the derived class.
 Multiple Inheritance: Multiple
Inheritance is a feature of C++
where a class can inherit from more
than one class. i.e one subclass is
inherited from more than one base
class.
Q:-Discuss various stream classes in C++?
In C++ there are number of stream
classes for defining various streams
related with files and for doing input-
output operations. All these classes
are defined in the file iostream.h.
Figure given below shows the
hierarchy of these classes.
Ios class is topmost class in the stream
classes hierarchy. It is the base class
for istream, ostream, and streambuf
class.
Istream and ostream serves the base
classes for iostream class. The class
istream is used for input and ostream
for the output.
Inheritance concepts Presentation (8).pptx
Inheritance concepts Presentation (8).pptx
Inheritance concepts Presentation (8).pptx

More Related Content

Similar to Inheritance concepts Presentation (8).pptx

Use Classes with Object-Oriented Programming in C++.ppt
Use Classes with Object-Oriented Programming in C++.pptUse Classes with Object-Oriented Programming in C++.ppt
Use Classes with Object-Oriented Programming in C++.pptmanishchoudhary91861
 
Learn C# Programming - Classes & Inheritance
Learn C# Programming - Classes & InheritanceLearn C# Programming - Classes & Inheritance
Learn C# Programming - Classes & InheritanceEng Teong Cheah
 
Introduction to C++ Programming
Introduction to C++ ProgrammingIntroduction to C++ Programming
Introduction to C++ ProgrammingPreeti Kashyap
 
C++Day-1 Introduction.ppt
C++Day-1 Introduction.pptC++Day-1 Introduction.ppt
C++Day-1 Introduction.pptcitizen15
 
4 pillars of OOPS CONCEPT
4 pillars of OOPS CONCEPT4 pillars of OOPS CONCEPT
4 pillars of OOPS CONCEPTAjay Chimmani
 
C++ Object Oriented Programming
C++  Object Oriented ProgrammingC++  Object Oriented Programming
C++ Object Oriented ProgrammingGamindu Udayanga
 
oop lecture 3
oop lecture 3oop lecture 3
oop lecture 3Atif Khan
 
Object oriented programming C++
Object oriented programming C++Object oriented programming C++
Object oriented programming C++AkshtaSuryawanshi
 
Synapseindia strcture of dotnet development part 1
Synapseindia strcture of dotnet development part 1Synapseindia strcture of dotnet development part 1
Synapseindia strcture of dotnet development part 1Synapseindiappsdevelopment
 
OOP interview questions & answers.
OOP interview questions & answers.OOP interview questions & answers.
OOP interview questions & answers.Questpond
 
Selenium Training .pptx
Selenium Training .pptxSelenium Training .pptx
Selenium Training .pptxSajidTk2
 
Interoduction to c++
Interoduction to c++Interoduction to c++
Interoduction to c++Amresh Raj
 

Similar to Inheritance concepts Presentation (8).pptx (20)

Class and object
Class and objectClass and object
Class and object
 
Use Classes with Object-Oriented Programming in C++.ppt
Use Classes with Object-Oriented Programming in C++.pptUse Classes with Object-Oriented Programming in C++.ppt
Use Classes with Object-Oriented Programming in C++.ppt
 
Learn C# Programming - Classes & Inheritance
Learn C# Programming - Classes & InheritanceLearn C# Programming - Classes & Inheritance
Learn C# Programming - Classes & Inheritance
 
Introduction to C++ Programming
Introduction to C++ ProgrammingIntroduction to C++ Programming
Introduction to C++ Programming
 
C++
C++C++
C++
 
C++Day-1 Introduction.ppt
C++Day-1 Introduction.pptC++Day-1 Introduction.ppt
C++Day-1 Introduction.ppt
 
4 pillars of OOPS CONCEPT
4 pillars of OOPS CONCEPT4 pillars of OOPS CONCEPT
4 pillars of OOPS CONCEPT
 
C++ Object Oriented Programming
C++  Object Oriented ProgrammingC++  Object Oriented Programming
C++ Object Oriented Programming
 
C# interview
C# interviewC# interview
C# interview
 
oop lecture 3
oop lecture 3oop lecture 3
oop lecture 3
 
Ppt of c++ vs c#
Ppt of c++ vs c#Ppt of c++ vs c#
Ppt of c++ vs c#
 
C++ classes
C++ classesC++ classes
C++ classes
 
Object oriented programming C++
Object oriented programming C++Object oriented programming C++
Object oriented programming C++
 
Synapseindia strcture of dotnet development part 1
Synapseindia strcture of dotnet development part 1Synapseindia strcture of dotnet development part 1
Synapseindia strcture of dotnet development part 1
 
OOP interview questions & answers.
OOP interview questions & answers.OOP interview questions & answers.
OOP interview questions & answers.
 
Oops
OopsOops
Oops
 
C++ presentation
C++ presentationC++ presentation
C++ presentation
 
Selenium Training .pptx
Selenium Training .pptxSelenium Training .pptx
Selenium Training .pptx
 
Oops
OopsOops
Oops
 
Interoduction to c++
Interoduction to c++Interoduction to c++
Interoduction to c++
 

Recently uploaded

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
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentInMediaRes1
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfadityarao40181
 
“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
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupJonathanParaisoCruz
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxJiesonDelaCerna
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...jaredbarbolino94
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerunnathinaik
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...M56BOOKSTORE PRODUCT/SERVICE
 
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
 
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)

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
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media Component
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdf
 
“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...
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized Group
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptx
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developer
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
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
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdf
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 

Inheritance concepts Presentation (8).pptx

  • 1. Q1:Define Inheritance? Name various types of Inheritance? Inheritance is a feature or a process in which, new classes are created from the existing classes. The new class created is called “derived class” or “child class” and the existing class is known as the “base class” or “parent class”. The derived class now is said to be inherited from the base class.
  • 2.
  • 3. Q:-What pure virtual function?  Pure virtual functions in C++ are virtual functions with no definition. We use the keyword “virtual” in C++ to declare a virtual function. They are assigned a value of zero when they are declared.  Syntax:- virtual void f()=0;
  • 4. Q:-What is data hiding?How it is achieved in C++? Data hiding is a technique of hiding internal object details, i.e., data members. It is an object-oriented programming technique. Data hiding ensures, or we can say guarantees to restrict the data access to class members. It maintains data integrity.
  • 5.  Example: We can understand data hiding with an example. Suppose we declared an Account class with a data member balance inside it. Here, the account balance is sensitive information. We may allow someone to check the account balance but won’t allow altering the balance attribute. So, by declaring the balance attribute private, we can restrict the access to balance from an outside application.
  • 6. It can be achieved by using private and protected specificer
  • 7. Q:-What is array of an object? Explain an example? In the array of object in C++, each element of an array becomes an object (same class’s), which means the array of object in C++ is a collection of objects of the same class. Just as an object is a collection of data-members and function-members. so each element of an array is a collection of data-member and function-member.
  • 8. Q:-What is function overoading? Give example?  Function overloading is a feature of object- oriented programming where two or more functions can have the same name but different parameters. When a function name is overloaded with different jobs it is called Function Overloading. In Function Overloading “Function” name should be the same and the arguments should be different.
  • 9. Q:- What are the various data types supported by C++?  C++ supports a wide variety of data types and the programmer can select the data type appropriate to the needs of the application. Data types specify the size and types of value to be stored.
  • 10.  Data types in C++ are mainly divided into three types:  1. Primitive Data Types: These data types are built-in or predefined data types and can be used directly by the user to declare variables. Primitive data types available in C++ are:  int  float  char  double
  • 11. 2.Derived Data Types: The data types that are derived from the primitive or built-in datatypes are referred to as Derived Data Types. These can be of four types namely: Function Array Pointer Reference
  • 12.  3.Abstract or User-Defined Data Types: These data types are defined by the user itself. Like, as defining a class in C++ or a structure. C++ provides the following user- defined datatypes:  Class  Structure  Union  Enumeration  Typedef
  • 13. Q1:-Compare public,private, protected visibility modes ? Public Access Modifier in C++All the variables and functions declared under the public access modifier will be available for everyone. They can be accessed both inside and outside the class. Dot (.) operator is used in the program to access public data members directly.
  • 14. Private access modifier All the variables and functions declared under a private access modifier can only be used inside the class. They are not permissible to be used by any object or function outside the class.
  • 15. Protected Access Modifiers C++Protected access modifiers are similar to the private access modifiers but protected access modifiers can be accessed in the derived class whereas private access modifiers cannot be accessed in the derived class.
  • 16.  Multiple Inheritance: Multiple Inheritance is a feature of C++ where a class can inherit from more than one class. i.e one subclass is inherited from more than one base class.
  • 17. Q:-Discuss various stream classes in C++? In C++ there are number of stream classes for defining various streams related with files and for doing input- output operations. All these classes are defined in the file iostream.h. Figure given below shows the hierarchy of these classes.
  • 18. Ios class is topmost class in the stream classes hierarchy. It is the base class for istream, ostream, and streambuf class. Istream and ostream serves the base classes for iostream class. The class istream is used for input and ostream for the output.