SlideShare a Scribd company logo
CLASSES
 Creating Objects:
Program#01:
Write a program that declares a class with one integer data member and two
member functions in() and out() to input and output data in data member.
Program#02:
Write a class Marks with three data members to store three marks. Write
three member functions
1)in() to input marks,
2)sum() to calculate and return the sum and
3) avg() to calculate and return the average marks
 Defining Member Functions Outside Class:
Program#01:
Write a program that declares a class with one integer data member and two
member functions in() and out() to input and output data in data member.
Program#02:
Write a class Array that contains an array of integers to store five values. It
also contains the following member functions:
1. The fill() function is used to fill the array with the values from the user.
2. The display() function is used to display values of array.
3. The max() function shows the maximum value in the array.
4. The min() function shows the minimum value in the array.
NOTE: All member function should be defined outside the class.
CONSTRUCTOR & DESTRUCTOR
 Constructor:
Program#1:
Write a class that has the displays a simple message on the screen whenever
an object of that class is created.
Program#2:
Write a Number class that contains two integer data members which are
initialized to 100 when an object is created. It has a member function avg()
that displays the average of data members.
 Passingparameters to constructor:
Program#1:
Write a program that passes parameter to constructor.
Program#2:
Write a program that passes parameter to constructor and constructor also
initializes its all attributes.
 Constructor Overloading:
Program#1:
Write a class OVER that has num and ch as data members. A constructor with
no parameters initializes num to 0 and ch to ‘x’. A constructor with two
parameters initializes data members with the given values and member
function show() displays the values of data members.
Program#2:
Write a class Book that has attributes for pages, price and title. It has two
functions to input the values and display the values. Create three objects
(b1,b2 and b3) of the class and input values.
 Destructor:
Program#1:
Write a program that demonstrate the use of Destructor.
Program#2:
Write a class Travel that has the attributes of kilometers and hours. A
constructor with no parameter initializes both data members to 0. a member
function get() inputs the values and function show() display the values. It has
the member function add() that takes an object of type Travel to add the
kilometers and hours of calling object and the parameter.
 Returning Objects from Member Functions:
Program#1:
Write a class Travel that has the attributes of kilometers and hours. A
constructor with no parameter initializes both data members to 0.
Program#2:
Write a class Travel that has the attributes of kilometers and hours. A
constructor with no parameter initializes both data members to 0.
STATIC DATA MEMBER
 Static Data Members:
Program#1:
Write a program that counts the number of objects created of a particular
class.
Program#2:
Write a program that clears concept of static member function.
FRIEND FUNCTIONS
 Friend Functions:
Program#1:
Write a program that demonstrate the use of Friend Function.
FRIEND CLASSES
 Friend Classes:
Program#1:
Write a program that demonstrates the use of Friend Classes.
STATIC FUNCTIONS
 Static Functions:
Program#1:
Write a program that demonstrate the use of Static Functions
.
Program#2:
Write a program that counts the number of objects created for a particular
class. The program must be able to display the results even if no object is
created so far.
OPERATOR OVERLOADING
 Operator Overloading:
Program#1:
Write a program that overloads increment operator to work with user-defined
objects.
Program#2:
Write a program that overloads binary addition operator +.
LAB MANUAL 2019
Subject:
Object Oriented Programming
Submitted By:
Hira Kanwal (279)
Submitted To:
Mam Lubna Meer
Submitted On:
9th May,2019
CONTENTS:
Classes
Constructor & Destructor
Static Data Member
Friend Function
Friend Classes
Static Function
Operator Overloading
Inheritance
Polymorphism
Templates
File Handling
INHERITANCE
 Specify a derived class
Program#1:
Write two classes Move and Move2. Move class has attribute of position
which is initialized to zero when an object is created. It also has a member
functions forward() which increments the value of position by 1 and show()
function to display the value of position.Move2 class is a derived class and has
a member function backward() to decrement the value of position by 1.
 AccessingConstructor of parent Class:
Program#1:
Write a program in which derived class access the constructor of parent class.
 Derived Class Constructor:
Program#1:
Write a program that explains the concepts of execution of constructor in
single inheritance.
Program#2:
Write a program that explains the concepts of derived class constructor in
inheritance.
 Function Overriding:
Program 1:
Write a program that explains concept of function overriding in inheritance.
Program#2:
Write a program that explains concept of function overriding.
 TYPES OF INHERITANCE:
 Public Inheritance:
Program#1:
Write a program that declares two classes and defines a relationship between
them using public inheritance.
 Protected Inheritance:
Program#1:
Write a program that declares two classes and defines a relationship between
them using protected inheritance.
 Private Inheritance:
Program#1:
Write a program that declares two classes and defines a relationship between
them using private inheritance.
 Multilevel Inheritance:
Program#1:
Write a program that demonstrate the use of multilevel inheritance.
Program#2:
Write a class Person that has the attributes of id, name and address. It has a
constructor to initialize, a member function to input and a member function to
display data members.
Create 2nd class Student that inherits Person class. It has additional attributes
of roll number and marks. It also has member function to input and display its
data members.
Create 3rd class Scholarship that inherits Student class. It has additional
attributes of Scholarship name and amount. It also has member function to
input and display its data members.
 Multilevel Inheritance with Parameters:
Program#1:

Multiple Inheritance:
Program#1:
Write a program that demonstrate the use of multiple inheritance.
 Constructor in Multiple Inheritance:
 Constructor without Parameters:
Program#1:
Write a program that demonstrates the use of constructor (without
parameter) in multiple inheritance.
 Constructor with Parameters:
Program#1:
Write a program that demonstrates the use of constructor (with parameter) in
multiple inheritance.
 Removing Ambiguity:
Program#1:
Write a program that demonstrate ambiguity in multiple inheritance.
Program#2:
Write a program that removes the ambiguity in multiple inheritance.
 Container Ship:
Program#1:
Write a class Result that has an array of integers as attributes. It has a member
function to input and a member function to display average of array elements.
Create another class Student that inherits Result class. It has additional
attributes of roll number, name and an object of type Result. It has a member
function to input and a member function to display its data members.
POLYMORPHISM &
VIRTUAL FUNCTIONS
 Pointer to objects:
Program#1:
Write a class with an integer data member, a function to input and a function
to display it. Create an object of the class using pointer and calls its member
functions.
 Array of Pointers to Objects:
Program#1:
Write a class that contains an attribute name, a function to input and a
function to display name. Create an array of pointers in which each element
refers to an object of the class.
 Pointers and Inheritance:
Program#1:
Write a program that demonstrate the use of pointer and inheritance.
 Virtual Function:
Program#1:
Write a program that demonstrate the use of virtual function.
 Early Binding:
Program#1:
Write a program that demonstrate the use of early binding.
 Late Binding:
Program#1:
Write a program that demonstrate the use of late binding(dynamic binding).
 Pure Virtual Function :
 Abstract Classes:
Program#1:
Write a program that demonstrate the use of Pure Virtual function.
 Virtual Base Class :
Program#1:
Write a program that demonstrate the use of Virtual Base Class.
Program#2:
Write a program that demonstrate the use of Virtual Base Class.
TEMPLATES
 Function Templates :
Program#1:
Write a program that accepts two numeric values and display the maximum
number. Use function template to find the maximum value.
Program#2:
Write a function template that accepts a value of any type and then display it.
 Class Template:
Program#1:
Write a class template that stores five values of any type in an array.
Program#2:
Write a function template that accepts a value of any type and then display it.
FILE HANDLING
 Writing Data to Formatted Files I/O:
Program#01:
Write a program that writes three characters in a file using formatted I/O.
Program#02:
Write a program that inputs the names of five cities and store them in a file
city.txt.
 Detecting End-of-File:
Program#01:
Write a program that displays all records from city.txt prepared in previous
example.
 Reading Lines From Files:
Program#01:
Write a program that stored five lines of strings in a file and then displays
them on the screen by reading these lines.
 Character I/O:
 Writing Single Character:
Program#01:
Write a program that inputs five characters from the user and stores them in
a file
OOP Programs

More Related Content

What's hot

OOPs & Inheritance Notes
OOPs & Inheritance NotesOOPs & Inheritance Notes
OOPs & Inheritance Notes
Shalabh Chaudhary
 
Functions in c language
Functions in c language Functions in c language
Functions in c language
tanmaymodi4
 
Input and output in C++
Input and output in C++Input and output in C++
Input and output in C++
Nilesh Dalvi
 
Datatype in c++ unit 3 -topic 2
Datatype in c++ unit 3 -topic 2Datatype in c++ unit 3 -topic 2
Datatype in c++ unit 3 -topic 2
MOHIT TOMAR
 
Core Java Tutorials by Mahika Tutorials
Core Java Tutorials by Mahika TutorialsCore Java Tutorials by Mahika Tutorials
Core Java Tutorials by Mahika Tutorials
Mahika Tutorials
 
C# basics
 C# basics C# basics
C# basics
Dinesh kumar
 
C#.NET
C#.NETC#.NET
C#.NET
gurchet
 
Introduction to kotlin
Introduction to kotlinIntroduction to kotlin
Introduction to kotlin
NAVER Engineering
 
Java tutorial PPT
Java tutorial PPTJava tutorial PPT
Java tutorial PPT
Intelligo Technologies
 
Scripting Languages
Scripting LanguagesScripting Languages
Scripting Languages
Forrester High School
 
Android share preferences
Android share preferencesAndroid share preferences
Android share preferences
Ajay Panchal
 
C# Tutorial
C# Tutorial C# Tutorial
C# Tutorial
Jm Ramos
 
This pointer
This pointerThis pointer
This pointer
Kamal Acharya
 
C++ programming
C++ programmingC++ programming
Object-oriented concepts
Object-oriented conceptsObject-oriented concepts
Object-oriented concepts
BG Java EE Course
 
cpp input & output system basics
cpp input & output system basicscpp input & output system basics
cpp input & output system basics
gourav kottawar
 
Introduction to flutter
Introduction to flutter Introduction to flutter
Introduction to flutter
Wan Muzaffar Wan Hashim
 
Files in java
Files in javaFiles in java
Flutter
FlutterFlutter
The Object Model
The Object Model  The Object Model
The Object Model
yndaravind
 

What's hot (20)

OOPs & Inheritance Notes
OOPs & Inheritance NotesOOPs & Inheritance Notes
OOPs & Inheritance Notes
 
Functions in c language
Functions in c language Functions in c language
Functions in c language
 
Input and output in C++
Input and output in C++Input and output in C++
Input and output in C++
 
Datatype in c++ unit 3 -topic 2
Datatype in c++ unit 3 -topic 2Datatype in c++ unit 3 -topic 2
Datatype in c++ unit 3 -topic 2
 
Core Java Tutorials by Mahika Tutorials
Core Java Tutorials by Mahika TutorialsCore Java Tutorials by Mahika Tutorials
Core Java Tutorials by Mahika Tutorials
 
C# basics
 C# basics C# basics
C# basics
 
C#.NET
C#.NETC#.NET
C#.NET
 
Introduction to kotlin
Introduction to kotlinIntroduction to kotlin
Introduction to kotlin
 
Java tutorial PPT
Java tutorial PPTJava tutorial PPT
Java tutorial PPT
 
Scripting Languages
Scripting LanguagesScripting Languages
Scripting Languages
 
Android share preferences
Android share preferencesAndroid share preferences
Android share preferences
 
C# Tutorial
C# Tutorial C# Tutorial
C# Tutorial
 
This pointer
This pointerThis pointer
This pointer
 
C++ programming
C++ programmingC++ programming
C++ programming
 
Object-oriented concepts
Object-oriented conceptsObject-oriented concepts
Object-oriented concepts
 
cpp input & output system basics
cpp input & output system basicscpp input & output system basics
cpp input & output system basics
 
Introduction to flutter
Introduction to flutter Introduction to flutter
Introduction to flutter
 
Files in java
Files in javaFiles in java
Files in java
 
Flutter
FlutterFlutter
Flutter
 
The Object Model
The Object Model  The Object Model
The Object Model
 

Similar to OOP Programs

C++ Lab Maual.pdf
C++ Lab Maual.pdfC++ Lab Maual.pdf
C++ Lab Maual.pdf
Thejeswara Reddy
 
C++ Lab Maual.pdf
C++ Lab Maual.pdfC++ Lab Maual.pdf
C++ Lab Maual.pdf
ShivamParjapati2
 
Intro To C++ - Class 14 - Midterm Review
Intro To C++ - Class 14 - Midterm ReviewIntro To C++ - Class 14 - Midterm Review
Intro To C++ - Class 14 - Midterm Review
Blue Elephant Consulting
 
.NET Portfolio
.NET Portfolio.NET Portfolio
.NET Portfolio
mwillmer
 
Cis 247 all i labs
Cis 247 all i labsCis 247 all i labs
Cis 247 all i labs
ccis224477
 
Book management system
Book management systemBook management system
Book management system
SHARDA SHARAN
 
Typescript language extension of java script
Typescript language extension of java scriptTypescript language extension of java script
Typescript language extension of java script
michaelaaron25322
 
Object Oriented Software Development, using c# programming language
Object Oriented Software Development, using c# programming languageObject Oriented Software Development, using c# programming language
Object Oriented Software Development, using c# programming language
Georges Abboudeh
 
OOP Assignment 03.pdf
OOP Assignment 03.pdfOOP Assignment 03.pdf
OOP Assignment 03.pdf
ARSLANMEHMOOD47
 
SE-IT JAVA LAB SYLLABUS
SE-IT JAVA LAB SYLLABUSSE-IT JAVA LAB SYLLABUS
SE-IT JAVA LAB SYLLABUS
nikshaikh786
 
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
Blue Elephant Consulting
 
HSc Computer Science Practical Slip for Class 12
HSc Computer Science Practical Slip for Class 12HSc Computer Science Practical Slip for Class 12
HSc Computer Science Practical Slip for Class 12
Aditi Bhushan
 
Shiny in R
Shiny in RShiny in R
Shiny in R
heba_ahmad
 
I assignmnt(oops)
I assignmnt(oops)I assignmnt(oops)
I assignmnt(oops)
Jay Patel
 
Introduction To C++ programming and its basic concepts
Introduction To C++ programming and its basic conceptsIntroduction To C++ programming and its basic concepts
Introduction To C++ programming and its basic concepts
ssuserf86fba
 
C# p3
C# p3C# p3
Lesson 5 - Getting Input from Users.pdf
Lesson 5 - Getting Input from Users.pdfLesson 5 - Getting Input from Users.pdf
Lesson 5 - Getting Input from Users.pdf
ROWELL MARQUINA
 
C Programming Lab manual 18CPL17
C Programming Lab manual 18CPL17C Programming Lab manual 18CPL17
C Programming Lab manual 18CPL17
manjurkts
 
CBCS 2018 Scheme I sem Lab Manual for 18CPL17
CBCS 2018 Scheme I sem Lab Manual for 18CPL17 CBCS 2018 Scheme I sem Lab Manual for 18CPL17
CBCS 2018 Scheme I sem Lab Manual for 18CPL17
manjurkts
 
Csharp
CsharpCsharp
Csharp
vinayabburi
 

Similar to OOP Programs (20)

C++ Lab Maual.pdf
C++ Lab Maual.pdfC++ Lab Maual.pdf
C++ Lab Maual.pdf
 
C++ Lab Maual.pdf
C++ Lab Maual.pdfC++ Lab Maual.pdf
C++ Lab Maual.pdf
 
Intro To C++ - Class 14 - Midterm Review
Intro To C++ - Class 14 - Midterm ReviewIntro To C++ - Class 14 - Midterm Review
Intro To C++ - Class 14 - Midterm Review
 
.NET Portfolio
.NET Portfolio.NET Portfolio
.NET Portfolio
 
Cis 247 all i labs
Cis 247 all i labsCis 247 all i labs
Cis 247 all i labs
 
Book management system
Book management systemBook management system
Book management system
 
Typescript language extension of java script
Typescript language extension of java scriptTypescript language extension of java script
Typescript language extension of java script
 
Object Oriented Software Development, using c# programming language
Object Oriented Software Development, using c# programming languageObject Oriented Software Development, using c# programming language
Object Oriented Software Development, using c# programming language
 
OOP Assignment 03.pdf
OOP Assignment 03.pdfOOP Assignment 03.pdf
OOP Assignment 03.pdf
 
SE-IT JAVA LAB SYLLABUS
SE-IT JAVA LAB SYLLABUSSE-IT JAVA LAB SYLLABUS
SE-IT JAVA LAB SYLLABUS
 
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
 
HSc Computer Science Practical Slip for Class 12
HSc Computer Science Practical Slip for Class 12HSc Computer Science Practical Slip for Class 12
HSc Computer Science Practical Slip for Class 12
 
Shiny in R
Shiny in RShiny in R
Shiny in R
 
I assignmnt(oops)
I assignmnt(oops)I assignmnt(oops)
I assignmnt(oops)
 
Introduction To C++ programming and its basic concepts
Introduction To C++ programming and its basic conceptsIntroduction To C++ programming and its basic concepts
Introduction To C++ programming and its basic concepts
 
C# p3
C# p3C# p3
C# p3
 
Lesson 5 - Getting Input from Users.pdf
Lesson 5 - Getting Input from Users.pdfLesson 5 - Getting Input from Users.pdf
Lesson 5 - Getting Input from Users.pdf
 
C Programming Lab manual 18CPL17
C Programming Lab manual 18CPL17C Programming Lab manual 18CPL17
C Programming Lab manual 18CPL17
 
CBCS 2018 Scheme I sem Lab Manual for 18CPL17
CBCS 2018 Scheme I sem Lab Manual for 18CPL17 CBCS 2018 Scheme I sem Lab Manual for 18CPL17
CBCS 2018 Scheme I sem Lab Manual for 18CPL17
 
Csharp
CsharpCsharp
Csharp
 

Recently uploaded

GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
Neo4j
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Malak Abu Hammad
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
Neo4j
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
Zilliz
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
mikeeftimakis1
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
Octavian Nadolu
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
Kari Kakkonen
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
KAMESHS29
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
tolgahangng
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
Matthew Sinclair
 
“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”
Claudio Di Ciccio
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
Adtran
 
How to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For FlutterHow to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For Flutter
Daiki Mogmet Ito
 
Mariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceXMariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceX
Mariano Tinti
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
Quotidiano Piemontese
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
kumardaparthi1024
 
Full-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalizationFull-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalization
Zilliz
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
Zilliz
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Paige Cruz
 

Recently uploaded (20)

GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
 
“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
 
How to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For FlutterHow to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For Flutter
 
Mariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceXMariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceX
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
 
Full-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalizationFull-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalization
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
 

OOP Programs

  • 1. CLASSES  Creating Objects: Program#01: Write a program that declares a class with one integer data member and two member functions in() and out() to input and output data in data member.
  • 2. Program#02: Write a class Marks with three data members to store three marks. Write three member functions 1)in() to input marks, 2)sum() to calculate and return the sum and 3) avg() to calculate and return the average marks
  • 3.
  • 4.  Defining Member Functions Outside Class: Program#01: Write a program that declares a class with one integer data member and two member functions in() and out() to input and output data in data member.
  • 5. Program#02: Write a class Array that contains an array of integers to store five values. It also contains the following member functions: 1. The fill() function is used to fill the array with the values from the user. 2. The display() function is used to display values of array. 3. The max() function shows the maximum value in the array. 4. The min() function shows the minimum value in the array. NOTE: All member function should be defined outside the class.
  • 6.
  • 7. CONSTRUCTOR & DESTRUCTOR  Constructor: Program#1: Write a class that has the displays a simple message on the screen whenever an object of that class is created.
  • 8. Program#2: Write a Number class that contains two integer data members which are initialized to 100 when an object is created. It has a member function avg() that displays the average of data members.
  • 9.  Passingparameters to constructor: Program#1: Write a program that passes parameter to constructor.
  • 10. Program#2: Write a program that passes parameter to constructor and constructor also initializes its all attributes.
  • 11.  Constructor Overloading: Program#1: Write a class OVER that has num and ch as data members. A constructor with no parameters initializes num to 0 and ch to ‘x’. A constructor with two parameters initializes data members with the given values and member function show() displays the values of data members.
  • 12. Program#2: Write a class Book that has attributes for pages, price and title. It has two functions to input the values and display the values. Create three objects (b1,b2 and b3) of the class and input values.
  • 13.  Destructor: Program#1: Write a program that demonstrate the use of Destructor.
  • 14. Program#2: Write a class Travel that has the attributes of kilometers and hours. A constructor with no parameter initializes both data members to 0. a member function get() inputs the values and function show() display the values. It has the member function add() that takes an object of type Travel to add the kilometers and hours of calling object and the parameter.
  • 15.  Returning Objects from Member Functions: Program#1: Write a class Travel that has the attributes of kilometers and hours. A constructor with no parameter initializes both data members to 0.
  • 16. Program#2: Write a class Travel that has the attributes of kilometers and hours. A constructor with no parameter initializes both data members to 0.
  • 17. STATIC DATA MEMBER  Static Data Members: Program#1: Write a program that counts the number of objects created of a particular class.
  • 18. Program#2: Write a program that clears concept of static member function.
  • 19. FRIEND FUNCTIONS  Friend Functions: Program#1: Write a program that demonstrate the use of Friend Function.
  • 20. FRIEND CLASSES  Friend Classes: Program#1: Write a program that demonstrates the use of Friend Classes.
  • 21. STATIC FUNCTIONS  Static Functions: Program#1: Write a program that demonstrate the use of Static Functions .
  • 22. Program#2: Write a program that counts the number of objects created for a particular class. The program must be able to display the results even if no object is created so far.
  • 23. OPERATOR OVERLOADING  Operator Overloading: Program#1: Write a program that overloads increment operator to work with user-defined objects.
  • 24. Program#2: Write a program that overloads binary addition operator +.
  • 25. LAB MANUAL 2019 Subject: Object Oriented Programming
  • 26. Submitted By: Hira Kanwal (279) Submitted To: Mam Lubna Meer Submitted On: 9th May,2019
  • 27. CONTENTS: Classes Constructor & Destructor Static Data Member Friend Function Friend Classes Static Function Operator Overloading Inheritance Polymorphism Templates File Handling
  • 28. INHERITANCE  Specify a derived class Program#1: Write two classes Move and Move2. Move class has attribute of position which is initialized to zero when an object is created. It also has a member functions forward() which increments the value of position by 1 and show() function to display the value of position.Move2 class is a derived class and has a member function backward() to decrement the value of position by 1.
  • 29.  AccessingConstructor of parent Class: Program#1: Write a program in which derived class access the constructor of parent class.
  • 30.  Derived Class Constructor: Program#1: Write a program that explains the concepts of execution of constructor in single inheritance.
  • 31. Program#2: Write a program that explains the concepts of derived class constructor in inheritance.
  • 32.  Function Overriding: Program 1: Write a program that explains concept of function overriding in inheritance.
  • 33.
  • 34. Program#2: Write a program that explains concept of function overriding.
  • 35.
  • 36.  TYPES OF INHERITANCE:  Public Inheritance: Program#1: Write a program that declares two classes and defines a relationship between them using public inheritance.
  • 37.  Protected Inheritance: Program#1: Write a program that declares two classes and defines a relationship between them using protected inheritance.
  • 38.  Private Inheritance: Program#1: Write a program that declares two classes and defines a relationship between them using private inheritance.
  • 39.
  • 40.  Multilevel Inheritance: Program#1: Write a program that demonstrate the use of multilevel inheritance.
  • 41.
  • 42. Program#2: Write a class Person that has the attributes of id, name and address. It has a constructor to initialize, a member function to input and a member function to display data members. Create 2nd class Student that inherits Person class. It has additional attributes of roll number and marks. It also has member function to input and display its data members. Create 3rd class Scholarship that inherits Student class. It has additional attributes of Scholarship name and amount. It also has member function to input and display its data members.
  • 43.
  • 44.  Multilevel Inheritance with Parameters: Program#1:
  • 45.
  • 46.  Multiple Inheritance: Program#1: Write a program that demonstrate the use of multiple inheritance.
  • 47.
  • 48.  Constructor in Multiple Inheritance:  Constructor without Parameters: Program#1: Write a program that demonstrates the use of constructor (without parameter) in multiple inheritance.
  • 49.  Constructor with Parameters: Program#1: Write a program that demonstrates the use of constructor (with parameter) in multiple inheritance.
  • 50.
  • 51.  Removing Ambiguity: Program#1: Write a program that demonstrate ambiguity in multiple inheritance.
  • 52. Program#2: Write a program that removes the ambiguity in multiple inheritance.
  • 53.  Container Ship: Program#1: Write a class Result that has an array of integers as attributes. It has a member function to input and a member function to display average of array elements. Create another class Student that inherits Result class. It has additional attributes of roll number, name and an object of type Result. It has a member function to input and a member function to display its data members.
  • 54.
  • 55. POLYMORPHISM & VIRTUAL FUNCTIONS  Pointer to objects: Program#1: Write a class with an integer data member, a function to input and a function to display it. Create an object of the class using pointer and calls its member functions.
  • 56.  Array of Pointers to Objects: Program#1: Write a class that contains an attribute name, a function to input and a function to display name. Create an array of pointers in which each element refers to an object of the class.
  • 57.  Pointers and Inheritance: Program#1: Write a program that demonstrate the use of pointer and inheritance.
  • 58.  Virtual Function: Program#1: Write a program that demonstrate the use of virtual function.
  • 59.  Early Binding: Program#1: Write a program that demonstrate the use of early binding.
  • 60.  Late Binding: Program#1: Write a program that demonstrate the use of late binding(dynamic binding).
  • 61.  Pure Virtual Function :  Abstract Classes: Program#1: Write a program that demonstrate the use of Pure Virtual function.
  • 62.  Virtual Base Class : Program#1: Write a program that demonstrate the use of Virtual Base Class.
  • 63. Program#2: Write a program that demonstrate the use of Virtual Base Class.
  • 64. TEMPLATES  Function Templates : Program#1: Write a program that accepts two numeric values and display the maximum number. Use function template to find the maximum value.
  • 65. Program#2: Write a function template that accepts a value of any type and then display it.
  • 66.  Class Template: Program#1: Write a class template that stores five values of any type in an array.
  • 67. Program#2: Write a function template that accepts a value of any type and then display it.
  • 68. FILE HANDLING  Writing Data to Formatted Files I/O: Program#01: Write a program that writes three characters in a file using formatted I/O.
  • 69. Program#02: Write a program that inputs the names of five cities and store them in a file city.txt.
  • 70.  Detecting End-of-File: Program#01: Write a program that displays all records from city.txt prepared in previous example.
  • 71.  Reading Lines From Files: Program#01: Write a program that stored five lines of strings in a file and then displays them on the screen by reading these lines.
  • 72.  Character I/O:  Writing Single Character: Program#01: Write a program that inputs five characters from the user and stores them in a file