SlideShare a Scribd company logo
AbdulRaouf N
arn.raouf@gmail.com
www.facebook.com/AbdulRaouf
twitter.com/username
in.linkedin.com/in/profilename
OOP CONCEPTS
Disclaimer: This presentation is prepared by trainees of
baabtra as a part of mentoring program. This is not official
document of baabtra –Mentoring Partner
Baabtra-Mentoring Partner is the mentoring division of baabte System Technologies Pvt . Ltd
OOP CONCEPT
• Object-oriented programming (OOP) is a style of
programming that focuses on using objects to design
and build applications.
• Think of an object as a model of the concepts,
processes, or things in the real world that are
meaningful to your application
OBJECT
• Which will have a name as identity
• Properties to define its behaviour
• Actions what it can perform
• It has two main properties:
– State: the object encapsulates information about
itself - attributes or fields.
– Behaviour: the object can do some things on
behalf of other objects – methods.
OBJECT(contd)
• Example:
In a banking system, a particular bank account is an
example of an object.
– Its state consists of attributes like: owner, account
number, balance, etc.
– Its behaviours consist of: deposit, withdraw, etc.
CLASS
• We need to create a base design which defines the
properties and functionalities that the object should
have.
• In programming terms we call this base design as
Class.
• We can create any number of objects from a class.
• Each individual object is called an instance of its
class.
CLASS(contd)
• The actions that can be performed by objects become
functions of the class and is referred to as Methods.
• No memory is allocated when a class is created. Memory
is allocated only when an object is created.
• Example:
Banking system is an example for class.
Different accounts are example for objects.
How to create class in C++
class shape //create a class
{
public: Int width;
Int height;
Int calculateArea()
{
return x*y
}
}
ATTRIBUTES
Contain current state of an object.
• Attributes can be classified as simple or complex.
• Simple attribute can be a primitive type such as
integer, string, etc.
• Complex attribute can contain collections and/or
references.
• Complex object: contains one or more complex
attributes
METHODS
• Defines behavior of an object, as a set of
encapsulated functions.
• The class describes those methods.
• It defines what an object can do.
INHERITANCE
 Inheritance allows child classes inherits the
characteristics of existing parent class.
• Attributes (fields and properties)
• Operations (methods)
 Child class can extend the parent class.
• Add new fields and methods
• Redefine methods (modify existing behavior)
INHERITANCE-Example/* C++ Program to calculate the area of rectangles using concept of inheritance.
#include <iostream>
using namespace std;
class Rectangle{
protected:float length, breadth;
public:
Rectangle(): length(0.0), breadth(0.0){
cout<<"Enter length: "; cin>>length;
cout<<"Enter breadth: "; cin>>breadth;
}};
/* Area class is derived from base class Rectangle. */
class Area : public Rectangle{
public:
float calc(){
return length*breadth;
}};
int main(){
cout<<"Enter data for rectangle to find area.n";
Area a;
cout<<"Area = "<<a.calc()<<" square meternn";
return 0;
}
ABSTRACTION
• Abstraction means ignoring irrelevant features,
properties, or functions and emphasizing the
relevant ones.
• Abstraction = managing complexity.
• Allows us to represent a complex reality in terms of a
simplified model.
• Abstraction highlights the properties of an entity that
we need and hides the others.
ENCAPSULATION
• Encapsulation hides the implementation
details
• Class announces some operations (methods)
available for its clients – its public interface
• All data members (fields) of a class should be
hidden-Accessed via properties (read-only and
read-write)
Example for Abstraction and Encapsulation
#include <iostream>
using namespace std;
class Adder{
public:// constructor
Adder(int i = 0){
total = i;}
// interface to outside world
void addNum(int number){
total += number;}
// interface to outside world
int getTotal(){
return total;};
private:// hidden data from outside world
int total;};
int main( ){
Adder a;
a.addNum(10); a.addNum(20); a.addNum(30);
cout << "Total " << a.getTotal() <<endl;
return 0;
}
POLYMORPHISM
• Polymorphism is the ability to take more than
one form.
• Polymorphism allows abstract operations to
be defined and used.
• Polymorphism allows routines to use variables
of different types at different times.
Example for Polymorphism
#include <iostream>
using namespace std;
class Shape { protected:int width, height;
public: Shape( int a=0, int b=0) { width = a; height = b; }
int area() { cout << "Parent class area :" <<endl; return 0; } } ;
class Rectangle: public Shape{
public:Rectangle( int a=0, int b=0):Shape(a, b) { }
int area (){
cout << "Rectangle class area :" <<endl; return (width * height);}};
class Triangle: public Shape{
public:Triangle( int a=0, int b=0):Shape(a, b) { }
int area (){
cout << "Triangle class area :" <<endl; return (width * height / 2);}};
// Main function for the program
int main( ){
Shape *shape; Rectangle rec(10,7); Triangle tri(10,5);
// store the address of Rectangle
shape = &rec;
// call rectangle area.
shape->area();
// store the address of Triangle
shape = &tri;
// call triangle area.
shape->area();
return 0; }
FUNCTION OVERLOADING
• It is simply defined as the ability of one
function to perform different tasks.
• For example, doTask() and doTask(object O)
are overloaded methods.
• To call the latter, an object must be passed as
a parameter, whereas the former does not
require a parameter, and is called with an
empty parameter field.
Example for Function Overloading
#include <iostream>
// volume of a cube
int volume(int s){
return s*s*s;
}
// volume of a triangle
float volume(int b, int h){
return 0.5*b*h;
}
// volume of a cuboid
long volume(long l, int b, int h){
return l*b*h;
}
int main(){
std::cout << volume(10);
std::cout << volume(9, 7);
std::cout << volume(100, 75, 15);
}
In the above example, the volume of various components are calculated using the same function
call "volume", with arguments differing in their data type or their number.
OPERATOR OVERLOADING
• Different operators have different
implementations depending on their
arguments.
• Operator overloading is generally defined by
the language, the programmer, or both.
• We can redefine or overload most of the built-
in operators available in C++.
Example for Operator Overloading
#include<iostream>
class complex
{
public: int real,imaginary;
complex operator+(complex ob)
{
complex t;
t.real=real+ob.real;
t.imaginary=imaginary+ob.imaginary;
return(t);
}
};
int main()
{
complex obj1,obj2,result;
obj1.real=12; obj2.imaginary=3;
obj2.real=8; obj2.imaginary=1;
result=obj1+obj2 // result=obj1.operator+(obj2);
cout<<result.real<<result.imaginary;
return 0;
}
THANK YOU
Want to learn more about programming or Looking to become a good programmer?
Are you wasting time on searching so many contents online?
Do you want to learn things quickly?
Tired of spending huge amount of money to become a Software professional?
Do an online course
@ baabtra.com
We put industry standards to practice. Our structured, activity based courses are so designed
to make a quick, good software professional out of anybody who holds a passion for coding.
Follow us @ twitter.com/baabtra
Like us @ facebook.com/baabtra
Subscribe to us @ youtube.com/baabtra
Become a follower @ slideshare.net/BaabtraMentoringPartner
Connect to us @ in.linkedin.com/in/baabtra
Thanks in advance.
www.baabtra.com | www.massbaab.com |www.baabte.com
Contact Us
Emarald Mall (Big Bazar Building)
Mavoor Road, Kozhikode,
Kerala, India.
Ph: + 91 – 495 40 25 550
NC Complex, Near Bus Stand
Mukkam, Kozhikode,
Kerala, India.
Ph: + 91 – 495 40 25 550
Cafit Square,
Hilite Business Park,
Near Pantheerankavu,
Kozhikode
Start up Village
Eranakulam,
Kerala, India.
Email: info@baabtra.com

More Related Content

What's hot

Static Data Members and Member Functions
Static Data Members and Member FunctionsStatic Data Members and Member Functions
Static Data Members and Member Functions
MOHIT AGARWAL
 
Inheritance In Java
Inheritance In JavaInheritance In Java
Inheritance In Java
Manish Sahu
 
Structure in c
Structure in cStructure in c
Structure in c
Prabhu Govind
 
Abstract class and Interface
Abstract class and InterfaceAbstract class and Interface
Abstract class and Interface
Haris Bin Zahid
 
Control Statements in Java
Control Statements in JavaControl Statements in Java
Control Statements in Java
Niloy Saha
 
Constructors and Destructor in C++
Constructors and Destructor in C++Constructors and Destructor in C++
Functions in C++
Functions in C++Functions in C++
Functions in C++
Pranali Chaudhari
 
Abstract class
Abstract classAbstract class
Abstract class
Tony Nguyen
 
Functions in C++
Functions in C++Functions in C++
Functions in C++
Mohammed Sikander
 
Friend function in c++
Friend function in c++ Friend function in c++
Friend function in c++
University of Madras
 
Interfaces in java
Interfaces in javaInterfaces in java
Interfaces in java
Abishek Purushothaman
 
Core java complete notes - Contact at +91-814-614-5674
Core java complete notes - Contact at +91-814-614-5674Core java complete notes - Contact at +91-814-614-5674
Core java complete notes - Contact at +91-814-614-5674
Lokesh Kakkar Mobile No. 814-614-5674
 
Java inheritance
Java inheritanceJava inheritance
Java inheritance
Arati Gadgil
 
Abstraction in c++ and Real Life Example of Abstraction in C++
Abstraction in c++ and Real Life Example of Abstraction in C++Abstraction in c++ and Real Life Example of Abstraction in C++
Abstraction in c++ and Real Life Example of Abstraction in C++
Hitesh Kumar
 
OOPS Basics With Example
OOPS Basics With ExampleOOPS Basics With Example
OOPS Basics With Example
Thooyavan Venkatachalam
 
Introduction to oop
Introduction to oopIntroduction to oop
Introduction to oop
colleges
 
Nested structure (Computer programming and utilization)
Nested structure (Computer programming and utilization)Nested structure (Computer programming and utilization)
Nested structure (Computer programming and utilization)
Digvijaysinh Gohil
 
Operator overloading
Operator overloadingOperator overloading
Operator overloading
Pranali Chaudhari
 
Functions in c
Functions in cFunctions in c
Functions in c
sunila tharagaturi
 
Oops concepts
Oops conceptsOops concepts
Oops concepts
Kanan Gandhi
 

What's hot (20)

Static Data Members and Member Functions
Static Data Members and Member FunctionsStatic Data Members and Member Functions
Static Data Members and Member Functions
 
Inheritance In Java
Inheritance In JavaInheritance In Java
Inheritance In Java
 
Structure in c
Structure in cStructure in c
Structure in c
 
Abstract class and Interface
Abstract class and InterfaceAbstract class and Interface
Abstract class and Interface
 
Control Statements in Java
Control Statements in JavaControl Statements in Java
Control Statements in Java
 
Constructors and Destructor in C++
Constructors and Destructor in C++Constructors and Destructor in C++
Constructors and Destructor in C++
 
Functions in C++
Functions in C++Functions in C++
Functions in C++
 
Abstract class
Abstract classAbstract class
Abstract class
 
Functions in C++
Functions in C++Functions in C++
Functions in C++
 
Friend function in c++
Friend function in c++ Friend function in c++
Friend function in c++
 
Interfaces in java
Interfaces in javaInterfaces in java
Interfaces in java
 
Core java complete notes - Contact at +91-814-614-5674
Core java complete notes - Contact at +91-814-614-5674Core java complete notes - Contact at +91-814-614-5674
Core java complete notes - Contact at +91-814-614-5674
 
Java inheritance
Java inheritanceJava inheritance
Java inheritance
 
Abstraction in c++ and Real Life Example of Abstraction in C++
Abstraction in c++ and Real Life Example of Abstraction in C++Abstraction in c++ and Real Life Example of Abstraction in C++
Abstraction in c++ and Real Life Example of Abstraction in C++
 
OOPS Basics With Example
OOPS Basics With ExampleOOPS Basics With Example
OOPS Basics With Example
 
Introduction to oop
Introduction to oopIntroduction to oop
Introduction to oop
 
Nested structure (Computer programming and utilization)
Nested structure (Computer programming and utilization)Nested structure (Computer programming and utilization)
Nested structure (Computer programming and utilization)
 
Operator overloading
Operator overloadingOperator overloading
Operator overloading
 
Functions in c
Functions in cFunctions in c
Functions in c
 
Oops concepts
Oops conceptsOops concepts
Oops concepts
 

Viewers also liked

Oop concepts
Oop conceptsOop concepts
Oop concepts
Ritu Mangla
 
Object oriented programming concept
Object oriented programming conceptObject oriented programming concept
Object oriented programming concept
Pina Parmar
 
Introduction to oops concepts
Introduction to oops conceptsIntroduction to oops concepts
Introduction to oops concepts
Nilesh Dalvi
 
Object-oriented programming
Object-oriented programmingObject-oriented programming
Object-oriented programming
Neelesh Shukla
 
Object-oriented concepts
Object-oriented conceptsObject-oriented concepts
Object-oriented concepts
BG Java EE Course
 
Introduction to Object Oriented Programming
Introduction to Object Oriented ProgrammingIntroduction to Object Oriented Programming
Introduction to Object Oriented Programming
Moutaz Haddara
 
Object Oriented Programming Concepts
Object Oriented Programming ConceptsObject Oriented Programming Concepts
Object Oriented Programming Conceptsthinkphp
 

Viewers also liked (9)

Oop concepts
Oop conceptsOop concepts
Oop concepts
 
Oop concept
Oop conceptOop concept
Oop concept
 
General OOP concept [by-Digvijay]
General OOP concept [by-Digvijay]General OOP concept [by-Digvijay]
General OOP concept [by-Digvijay]
 
Object oriented programming concept
Object oriented programming conceptObject oriented programming concept
Object oriented programming concept
 
Introduction to oops concepts
Introduction to oops conceptsIntroduction to oops concepts
Introduction to oops concepts
 
Object-oriented programming
Object-oriented programmingObject-oriented programming
Object-oriented programming
 
Object-oriented concepts
Object-oriented conceptsObject-oriented concepts
Object-oriented concepts
 
Introduction to Object Oriented Programming
Introduction to Object Oriented ProgrammingIntroduction to Object Oriented Programming
Introduction to Object Oriented Programming
 
Object Oriented Programming Concepts
Object Oriented Programming ConceptsObject Oriented Programming Concepts
Object Oriented Programming Concepts
 

Similar to Oop concepts

Oop concept in c++ by MUhammed Thanveer Melayi
Oop concept in c++ by MUhammed Thanveer MelayiOop concept in c++ by MUhammed Thanveer Melayi
Oop concept in c++ by MUhammed Thanveer Melayi
Muhammed Thanveer M
 
OOC MODULE1.pptx
OOC MODULE1.pptxOOC MODULE1.pptx
OOC MODULE1.pptx
1HK19CS090MOHAMMEDSA
 
Unit3_OOP-converted.pdf
Unit3_OOP-converted.pdfUnit3_OOP-converted.pdf
Unit3_OOP-converted.pdf
PowerfullBoy1
 
Ch.1 oop introduction, classes and objects
Ch.1 oop introduction, classes and objectsCh.1 oop introduction, classes and objects
Ch.1 oop introduction, classes and objects
ITNet
 
classes & objects.ppt
classes & objects.pptclasses & objects.ppt
classes & objects.ppt
BArulmozhi
 
c++ Unit I.pptx
c++ Unit I.pptxc++ Unit I.pptx
Object Oriented Programming using C++: Ch06 Objects and Classes.pptx
Object Oriented Programming using C++: Ch06 Objects and Classes.pptxObject Oriented Programming using C++: Ch06 Objects and Classes.pptx
Object Oriented Programming using C++: Ch06 Objects and Classes.pptx
RashidFaridChishti
 
Presentation 4th
Presentation 4thPresentation 4th
Presentation 4thConnex
 
3. Polymorphism.pptx
3. Polymorphism.pptx3. Polymorphism.pptx
3. Polymorphism.pptx
ChhaviCoachingCenter
 
Oops lecture 1
Oops lecture 1Oops lecture 1
Oops lecture 1
rehan16091997
 
2nd puc computer science chapter 8 function overloading
 2nd puc computer science chapter 8   function overloading 2nd puc computer science chapter 8   function overloading
2nd puc computer science chapter 8 function overloading
Aahwini Esware gowda
 
Object oriented programming 2
Object oriented programming 2Object oriented programming 2
Object oriented programming 2
Aadil Ansari
 
14 operator overloading
14 operator overloading14 operator overloading
14 operator overloading
Docent Education
 
21CSC101T best ppt ever OODP UNIT-2.pptx
21CSC101T best ppt ever OODP UNIT-2.pptx21CSC101T best ppt ever OODP UNIT-2.pptx
21CSC101T best ppt ever OODP UNIT-2.pptx
Anantjain234527
 
oops.pptx
oops.pptxoops.pptx
oops.pptx
ASHWINAIT2021
 
Object Oriented Programming using C++(UNIT 1)
Object Oriented Programming using C++(UNIT 1)Object Oriented Programming using C++(UNIT 1)
Object Oriented Programming using C++(UNIT 1)
SURBHI SAROHA
 

Similar to Oop concepts (20)

Lecture02
Lecture02Lecture02
Lecture02
 
Oop concept
Oop conceptOop concept
Oop concept
 
Oops concept
Oops conceptOops concept
Oops concept
 
Bc0037
Bc0037Bc0037
Bc0037
 
Oop concept in c++ by MUhammed Thanveer Melayi
Oop concept in c++ by MUhammed Thanveer MelayiOop concept in c++ by MUhammed Thanveer Melayi
Oop concept in c++ by MUhammed Thanveer Melayi
 
OOC MODULE1.pptx
OOC MODULE1.pptxOOC MODULE1.pptx
OOC MODULE1.pptx
 
Unit3_OOP-converted.pdf
Unit3_OOP-converted.pdfUnit3_OOP-converted.pdf
Unit3_OOP-converted.pdf
 
Ch.1 oop introduction, classes and objects
Ch.1 oop introduction, classes and objectsCh.1 oop introduction, classes and objects
Ch.1 oop introduction, classes and objects
 
classes & objects.ppt
classes & objects.pptclasses & objects.ppt
classes & objects.ppt
 
c++ Unit I.pptx
c++ Unit I.pptxc++ Unit I.pptx
c++ Unit I.pptx
 
Object Oriented Programming using C++: Ch06 Objects and Classes.pptx
Object Oriented Programming using C++: Ch06 Objects and Classes.pptxObject Oriented Programming using C++: Ch06 Objects and Classes.pptx
Object Oriented Programming using C++: Ch06 Objects and Classes.pptx
 
Presentation 4th
Presentation 4thPresentation 4th
Presentation 4th
 
3. Polymorphism.pptx
3. Polymorphism.pptx3. Polymorphism.pptx
3. Polymorphism.pptx
 
Oops lecture 1
Oops lecture 1Oops lecture 1
Oops lecture 1
 
2nd puc computer science chapter 8 function overloading
 2nd puc computer science chapter 8   function overloading 2nd puc computer science chapter 8   function overloading
2nd puc computer science chapter 8 function overloading
 
Object oriented programming 2
Object oriented programming 2Object oriented programming 2
Object oriented programming 2
 
14 operator overloading
14 operator overloading14 operator overloading
14 operator overloading
 
21CSC101T best ppt ever OODP UNIT-2.pptx
21CSC101T best ppt ever OODP UNIT-2.pptx21CSC101T best ppt ever OODP UNIT-2.pptx
21CSC101T best ppt ever OODP UNIT-2.pptx
 
oops.pptx
oops.pptxoops.pptx
oops.pptx
 
Object Oriented Programming using C++(UNIT 1)
Object Oriented Programming using C++(UNIT 1)Object Oriented Programming using C++(UNIT 1)
Object Oriented Programming using C++(UNIT 1)
 

More from baabtra.com - No. 1 supplier of quality freshers

Acquiring new skills what you should know
Acquiring new skills   what you should knowAcquiring new skills   what you should know
Acquiring new skills what you should know
baabtra.com - No. 1 supplier of quality freshers
 
Baabtra.com programming at school
Baabtra.com programming at schoolBaabtra.com programming at school
Baabtra.com programming at school
baabtra.com - No. 1 supplier of quality freshers
 
99LMS for Enterprises - LMS that you will love
99LMS for Enterprises - LMS that you will love 99LMS for Enterprises - LMS that you will love
99LMS for Enterprises - LMS that you will love
baabtra.com - No. 1 supplier of quality freshers
 
Php database connectivity
Php database connectivityPhp database connectivity
Chapter 6 database normalisation
Chapter 6  database normalisationChapter 6  database normalisation
Chapter 6 database normalisation
baabtra.com - No. 1 supplier of quality freshers
 
Chapter 5 transactions and dcl statements
Chapter 5  transactions and dcl statementsChapter 5  transactions and dcl statements
Chapter 5 transactions and dcl statements
baabtra.com - No. 1 supplier of quality freshers
 
Chapter 4 functions, views, indexing
Chapter 4  functions, views, indexingChapter 4  functions, views, indexing
Chapter 4 functions, views, indexing
baabtra.com - No. 1 supplier of quality freshers
 
Chapter 3 stored procedures
Chapter 3 stored proceduresChapter 3 stored procedures
Chapter 2 grouping,scalar and aggergate functions,joins inner join,outer join
Chapter 2  grouping,scalar and aggergate functions,joins   inner join,outer joinChapter 2  grouping,scalar and aggergate functions,joins   inner join,outer join
Chapter 2 grouping,scalar and aggergate functions,joins inner join,outer join
baabtra.com - No. 1 supplier of quality freshers
 
Chapter 1 introduction to sql server
Chapter 1 introduction to sql serverChapter 1 introduction to sql server
Chapter 1 introduction to sql server
baabtra.com - No. 1 supplier of quality freshers
 
Microsoft holo lens
Microsoft holo lensMicrosoft holo lens
Blue brain
Blue brainBlue brain
5g
5g5g
Aptitude skills baabtra
Aptitude skills baabtraAptitude skills baabtra

More from baabtra.com - No. 1 supplier of quality freshers (20)

Agile methodology and scrum development
Agile methodology and scrum developmentAgile methodology and scrum development
Agile methodology and scrum development
 
Best coding practices
Best coding practicesBest coding practices
Best coding practices
 
Core java - baabtra
Core java - baabtraCore java - baabtra
Core java - baabtra
 
Acquiring new skills what you should know
Acquiring new skills   what you should knowAcquiring new skills   what you should know
Acquiring new skills what you should know
 
Baabtra.com programming at school
Baabtra.com programming at schoolBaabtra.com programming at school
Baabtra.com programming at school
 
99LMS for Enterprises - LMS that you will love
99LMS for Enterprises - LMS that you will love 99LMS for Enterprises - LMS that you will love
99LMS for Enterprises - LMS that you will love
 
Php sessions & cookies
Php sessions & cookiesPhp sessions & cookies
Php sessions & cookies
 
Php database connectivity
Php database connectivityPhp database connectivity
Php database connectivity
 
Chapter 6 database normalisation
Chapter 6  database normalisationChapter 6  database normalisation
Chapter 6 database normalisation
 
Chapter 5 transactions and dcl statements
Chapter 5  transactions and dcl statementsChapter 5  transactions and dcl statements
Chapter 5 transactions and dcl statements
 
Chapter 4 functions, views, indexing
Chapter 4  functions, views, indexingChapter 4  functions, views, indexing
Chapter 4 functions, views, indexing
 
Chapter 3 stored procedures
Chapter 3 stored proceduresChapter 3 stored procedures
Chapter 3 stored procedures
 
Chapter 2 grouping,scalar and aggergate functions,joins inner join,outer join
Chapter 2  grouping,scalar and aggergate functions,joins   inner join,outer joinChapter 2  grouping,scalar and aggergate functions,joins   inner join,outer join
Chapter 2 grouping,scalar and aggergate functions,joins inner join,outer join
 
Chapter 1 introduction to sql server
Chapter 1 introduction to sql serverChapter 1 introduction to sql server
Chapter 1 introduction to sql server
 
Chapter 1 introduction to sql server
Chapter 1 introduction to sql serverChapter 1 introduction to sql server
Chapter 1 introduction to sql server
 
Microsoft holo lens
Microsoft holo lensMicrosoft holo lens
Microsoft holo lens
 
Blue brain
Blue brainBlue brain
Blue brain
 
5g
5g5g
5g
 
Aptitude skills baabtra
Aptitude skills baabtraAptitude skills baabtra
Aptitude skills baabtra
 
Gd baabtra
Gd baabtraGd baabtra
Gd baabtra
 

Recently uploaded

AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
Product School
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User Group
CatarinaPereira64715
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
Elena Simperl
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
DianaGray10
 
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
Abida Shariff
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
Elena Simperl
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi
Fwdays
 
Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical Futures
Bhaskar Mitra
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Product School
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
Product School
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
RTTS
 

Recently uploaded (20)

AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User Group
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi
 
Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical Futures
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
 

Oop concepts

  • 1.
  • 3. Disclaimer: This presentation is prepared by trainees of baabtra as a part of mentoring program. This is not official document of baabtra –Mentoring Partner Baabtra-Mentoring Partner is the mentoring division of baabte System Technologies Pvt . Ltd
  • 4. OOP CONCEPT • Object-oriented programming (OOP) is a style of programming that focuses on using objects to design and build applications. • Think of an object as a model of the concepts, processes, or things in the real world that are meaningful to your application
  • 5. OBJECT • Which will have a name as identity • Properties to define its behaviour • Actions what it can perform • It has two main properties: – State: the object encapsulates information about itself - attributes or fields. – Behaviour: the object can do some things on behalf of other objects – methods.
  • 6. OBJECT(contd) • Example: In a banking system, a particular bank account is an example of an object. – Its state consists of attributes like: owner, account number, balance, etc. – Its behaviours consist of: deposit, withdraw, etc.
  • 7. CLASS • We need to create a base design which defines the properties and functionalities that the object should have. • In programming terms we call this base design as Class. • We can create any number of objects from a class. • Each individual object is called an instance of its class.
  • 8. CLASS(contd) • The actions that can be performed by objects become functions of the class and is referred to as Methods. • No memory is allocated when a class is created. Memory is allocated only when an object is created. • Example: Banking system is an example for class. Different accounts are example for objects.
  • 9. How to create class in C++ class shape //create a class { public: Int width; Int height; Int calculateArea() { return x*y } }
  • 10. ATTRIBUTES Contain current state of an object. • Attributes can be classified as simple or complex. • Simple attribute can be a primitive type such as integer, string, etc. • Complex attribute can contain collections and/or references. • Complex object: contains one or more complex attributes
  • 11. METHODS • Defines behavior of an object, as a set of encapsulated functions. • The class describes those methods. • It defines what an object can do.
  • 12. INHERITANCE  Inheritance allows child classes inherits the characteristics of existing parent class. • Attributes (fields and properties) • Operations (methods)  Child class can extend the parent class. • Add new fields and methods • Redefine methods (modify existing behavior)
  • 13. INHERITANCE-Example/* C++ Program to calculate the area of rectangles using concept of inheritance. #include <iostream> using namespace std; class Rectangle{ protected:float length, breadth; public: Rectangle(): length(0.0), breadth(0.0){ cout<<"Enter length: "; cin>>length; cout<<"Enter breadth: "; cin>>breadth; }}; /* Area class is derived from base class Rectangle. */ class Area : public Rectangle{ public: float calc(){ return length*breadth; }}; int main(){ cout<<"Enter data for rectangle to find area.n"; Area a; cout<<"Area = "<<a.calc()<<" square meternn"; return 0; }
  • 14. ABSTRACTION • Abstraction means ignoring irrelevant features, properties, or functions and emphasizing the relevant ones. • Abstraction = managing complexity. • Allows us to represent a complex reality in terms of a simplified model. • Abstraction highlights the properties of an entity that we need and hides the others.
  • 15. ENCAPSULATION • Encapsulation hides the implementation details • Class announces some operations (methods) available for its clients – its public interface • All data members (fields) of a class should be hidden-Accessed via properties (read-only and read-write)
  • 16. Example for Abstraction and Encapsulation #include <iostream> using namespace std; class Adder{ public:// constructor Adder(int i = 0){ total = i;} // interface to outside world void addNum(int number){ total += number;} // interface to outside world int getTotal(){ return total;}; private:// hidden data from outside world int total;}; int main( ){ Adder a; a.addNum(10); a.addNum(20); a.addNum(30); cout << "Total " << a.getTotal() <<endl; return 0; }
  • 17. POLYMORPHISM • Polymorphism is the ability to take more than one form. • Polymorphism allows abstract operations to be defined and used. • Polymorphism allows routines to use variables of different types at different times.
  • 18. Example for Polymorphism #include <iostream> using namespace std; class Shape { protected:int width, height; public: Shape( int a=0, int b=0) { width = a; height = b; } int area() { cout << "Parent class area :" <<endl; return 0; } } ; class Rectangle: public Shape{ public:Rectangle( int a=0, int b=0):Shape(a, b) { } int area (){ cout << "Rectangle class area :" <<endl; return (width * height);}}; class Triangle: public Shape{ public:Triangle( int a=0, int b=0):Shape(a, b) { } int area (){ cout << "Triangle class area :" <<endl; return (width * height / 2);}}; // Main function for the program int main( ){ Shape *shape; Rectangle rec(10,7); Triangle tri(10,5); // store the address of Rectangle shape = &rec; // call rectangle area. shape->area(); // store the address of Triangle shape = &tri; // call triangle area. shape->area(); return 0; }
  • 19. FUNCTION OVERLOADING • It is simply defined as the ability of one function to perform different tasks. • For example, doTask() and doTask(object O) are overloaded methods. • To call the latter, an object must be passed as a parameter, whereas the former does not require a parameter, and is called with an empty parameter field.
  • 20. Example for Function Overloading #include <iostream> // volume of a cube int volume(int s){ return s*s*s; } // volume of a triangle float volume(int b, int h){ return 0.5*b*h; } // volume of a cuboid long volume(long l, int b, int h){ return l*b*h; } int main(){ std::cout << volume(10); std::cout << volume(9, 7); std::cout << volume(100, 75, 15); } In the above example, the volume of various components are calculated using the same function call "volume", with arguments differing in their data type or their number.
  • 21. OPERATOR OVERLOADING • Different operators have different implementations depending on their arguments. • Operator overloading is generally defined by the language, the programmer, or both. • We can redefine or overload most of the built- in operators available in C++.
  • 22. Example for Operator Overloading #include<iostream> class complex { public: int real,imaginary; complex operator+(complex ob) { complex t; t.real=real+ob.real; t.imaginary=imaginary+ob.imaginary; return(t); } }; int main() { complex obj1,obj2,result; obj1.real=12; obj2.imaginary=3; obj2.real=8; obj2.imaginary=1; result=obj1+obj2 // result=obj1.operator+(obj2); cout<<result.real<<result.imaginary; return 0; }
  • 24. Want to learn more about programming or Looking to become a good programmer? Are you wasting time on searching so many contents online? Do you want to learn things quickly? Tired of spending huge amount of money to become a Software professional? Do an online course @ baabtra.com We put industry standards to practice. Our structured, activity based courses are so designed to make a quick, good software professional out of anybody who holds a passion for coding.
  • 25. Follow us @ twitter.com/baabtra Like us @ facebook.com/baabtra Subscribe to us @ youtube.com/baabtra Become a follower @ slideshare.net/BaabtraMentoringPartner Connect to us @ in.linkedin.com/in/baabtra Thanks in advance. www.baabtra.com | www.massbaab.com |www.baabte.com
  • 26. Contact Us Emarald Mall (Big Bazar Building) Mavoor Road, Kozhikode, Kerala, India. Ph: + 91 – 495 40 25 550 NC Complex, Near Bus Stand Mukkam, Kozhikode, Kerala, India. Ph: + 91 – 495 40 25 550 Cafit Square, Hilite Business Park, Near Pantheerankavu, Kozhikode Start up Village Eranakulam, Kerala, India. Email: info@baabtra.com