SlideShare a Scribd company logo
2
Most read
3
Most read
7
Most read
 
What is Inheritance  Polymorphism  is the ability to use an operator or function in different ways. Polymorphism gives different meanings or functions to the operators or functions.
Poly, referring to many, signifies the many uses of these operators and functions. A single function usage or an operator functioning in many ways can be called polymorphism. Polymorphism refers to codes, operations or objects that behave differently in different contexts.
#include <iostream> using namespace std; class CPolygon {     protected:       int width, height;     public:       void set_values (int a, int b)         { width=a; height=b; } };     class CRectangle: public CPolygon {     public:       int area ()         { return (width * height); }     };     Example of Inheritance 
class CTriangle: public CPolygon {     public:       int area ()         {         return (width * height / 2);         } };    
Int main () {     CRectangle rect;     CTriangle trgl;     CPolygon * ppoly1 = &rect;     CPolygon * ppoly2 = &trgl;     ppoly1->set_values (4,5);     ppoly2->set_values (4,5);     cout << rect.area() << endl;     cout << trgl.area() << endl;     return 0;   }
Get more programming tutorial www.cprogrammings.com

More Related Content

PPTX
Polymorphism in C++
PPTX
Polymorphism Using C++
PPTX
Polymorphism in java
PDF
Polymorphism in Java
PPTX
Polymorphism
PPTX
Polymorphism in c++(ppt)
PPTX
Polymorphism
PPTX
Virtual base class
Polymorphism in C++
Polymorphism Using C++
Polymorphism in java
Polymorphism in Java
Polymorphism
Polymorphism in c++(ppt)
Polymorphism
Virtual base class

What's hot (20)

PPT
Introduction to method overloading &amp; method overriding in java hdm
PPTX
C++ concept of Polymorphism
PDF
Function overloading ppt
PDF
Operator overloading
PPTX
Polymorphism In c++
PPTX
Oop c++class(final).ppt
PPT
Polymorphism in java, method overloading and method overriding
PPTX
Virtual function in C++ Pure Virtual Function
PPTX
String, string builder, string buffer
PPTX
The Switch Statement in java
PPT
JAVA OOP
PPTX
classes and objects in C++
PPT
16 virtual function
PPTX
Type casting in java
PPT
Late and Early binding in c++
PDF
Polymorphism
PDF
Polymorphism In Java
PPTX
Python-Classes.pptx
PPTX
Polymorphism
PPTX
20.3 Java encapsulation
Introduction to method overloading &amp; method overriding in java hdm
C++ concept of Polymorphism
Function overloading ppt
Operator overloading
Polymorphism In c++
Oop c++class(final).ppt
Polymorphism in java, method overloading and method overriding
Virtual function in C++ Pure Virtual Function
String, string builder, string buffer
The Switch Statement in java
JAVA OOP
classes and objects in C++
16 virtual function
Type casting in java
Late and Early binding in c++
Polymorphism
Polymorphism In Java
Python-Classes.pptx
Polymorphism
20.3 Java encapsulation
Ad

Viewers also liked (20)

PPTX
polymorphism
PPTX
Seminar on polymorphism
PPT
Polymorphism
PPTX
Polymorphism
PPT
Static and Dynamic polymorphism in C++
PPSX
Polymorphism
PPTX
Polymorphism
PPTX
Compile time polymorphism
PPT
Inheritance in c++ ppt (Powerpoint) | inheritance in c++ ppt presentation | i...
PPTX
Genetic polymorphism
PPTX
pointers,virtual functions and polymorphism
PPTX
Dynamic Polymorphism in C++
PPT
C++ polymorphism
PPT
Gentic polymorphism
DOCX
Computer science seminar topics
PPT
pointers, virtual functions and polymorphisms in c++ || in cpp
PPT
JAVA Polymorphism
PPTX
Method overloading and constructor overloading in java
polymorphism
Seminar on polymorphism
Polymorphism
Polymorphism
Static and Dynamic polymorphism in C++
Polymorphism
Polymorphism
Compile time polymorphism
Inheritance in c++ ppt (Powerpoint) | inheritance in c++ ppt presentation | i...
Genetic polymorphism
pointers,virtual functions and polymorphism
Dynamic Polymorphism in C++
C++ polymorphism
Gentic polymorphism
Computer science seminar topics
pointers, virtual functions and polymorphisms in c++ || in cpp
JAVA Polymorphism
Method overloading and constructor overloading in java
Ad

Similar to Polymorphism in c++ ppt (Powerpoint) | Polymorphism in c++ with example ppt | Polymorphism in c++ ppt presentation (20)

DOCX
Bc0037
PDF
Polymorphism in Java by Animesh Sarkar
PPTX
Virtual function
PPTX
oops.pptx
PPTX
Polymorphismupload
PPTX
Polymorphism and Virtual Functions ppt bioinformatics
PPTX
Ch.1 oop introduction, classes and objects
PPTX
OOC MODULE1.pptx
PPTX
C++ theory
PPTX
computer.pptx. on the topic of object oriented program
PPT
Function overloading(c++)
PPT
Function oveloading
PPT
Function overloading(C++)
PDF
polymorphism.pdf
PPTX
Polymorphism & Templates
PDF
Functions And Header Files In C++ | Bjarne stroustrup
PDF
Polymorphism and Type Conversion.pdf pot
PPTX
Classes function overloading
PDF
2nd puc computer science chapter 8 function overloading
Bc0037
Polymorphism in Java by Animesh Sarkar
Virtual function
oops.pptx
Polymorphismupload
Polymorphism and Virtual Functions ppt bioinformatics
Ch.1 oop introduction, classes and objects
OOC MODULE1.pptx
C++ theory
computer.pptx. on the topic of object oriented program
Function overloading(c++)
Function oveloading
Function overloading(C++)
polymorphism.pdf
Polymorphism & Templates
Functions And Header Files In C++ | Bjarne stroustrup
Polymorphism and Type Conversion.pdf pot
Classes function overloading
2nd puc computer science chapter 8 function overloading

Recently uploaded (20)

PDF
Classroom Observation Tools for Teachers
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PPTX
Orientation - ARALprogram of Deped to the Parents.pptx
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PDF
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PDF
VCE English Exam - Section C Student Revision Booklet
PDF
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
PDF
Chinmaya Tiranga quiz Grand Finale.pdf
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PDF
Weekly quiz Compilation Jan -July 25.pdf
PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
PPTX
GDM (1) (1).pptx small presentation for students
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
Classroom Observation Tools for Teachers
2.FourierTransform-ShortQuestionswithAnswers.pdf
STATICS OF THE RIGID BODIES Hibbelers.pdf
Supply Chain Operations Speaking Notes -ICLT Program
Orientation - ARALprogram of Deped to the Parents.pptx
Module 4: Burden of Disease Tutorial Slides S2 2025
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
Final Presentation General Medicine 03-08-2024.pptx
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
O5-L3 Freight Transport Ops (International) V1.pdf
Final Presentation General Medicine 03-08-2024.pptx
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
VCE English Exam - Section C Student Revision Booklet
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
Chinmaya Tiranga quiz Grand Finale.pdf
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
Weekly quiz Compilation Jan -July 25.pdf
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
GDM (1) (1).pptx small presentation for students
human mycosis Human fungal infections are called human mycosis..pptx

Polymorphism in c++ ppt (Powerpoint) | Polymorphism in c++ with example ppt | Polymorphism in c++ ppt presentation

  • 1.  
  • 2. What is Inheritance  Polymorphism  is the ability to use an operator or function in different ways. Polymorphism gives different meanings or functions to the operators or functions.
  • 3. Poly, referring to many, signifies the many uses of these operators and functions. A single function usage or an operator functioning in many ways can be called polymorphism. Polymorphism refers to codes, operations or objects that behave differently in different contexts.
  • 4. #include <iostream> using namespace std; class CPolygon {     protected:       int width, height;     public:       void set_values (int a, int b)         { width=a; height=b; } };     class CRectangle: public CPolygon {     public:       int area ()         { return (width * height); }     };     Example of Inheritance 
  • 5. class CTriangle: public CPolygon {     public:       int area ()         {         return (width * height / 2);         } };    
  • 6. Int main () {     CRectangle rect;     CTriangle trgl;     CPolygon * ppoly1 = &rect;     CPolygon * ppoly2 = &trgl;     ppoly1->set_values (4,5);     ppoly2->set_values (4,5);     cout << rect.area() << endl;     cout << trgl.area() << endl;     return 0;   }
  • 7. Get more programming tutorial www.cprogrammings.com