SlideShare a Scribd company logo
Object Oriented Programming
using C++
P.Nivetha,
Dept. of BCA,
Bon Secours college for Women,
Thanjavur.
Some Features of OOP languages
 An OOP language should support
– Easy Representation of
 Real-world objects
 Their States and Abilities
– Interaction with objects of same type
– Relations with objects of other type
– Polymorphism and Overloading
 Reusability of code
 Convenient type definitions
Basic Syntax
 Same as C
 Additional operators
 Additional keywords
Programming Paradigms
 Procedural Programming (functions)
 Modular Programming (namespaces)
 Object Oriented Programming (classes)
 Generic Programming (templates)
Procedural Programming
 A program is a list of instructions
 Concentration is on what is to be done?
 Problems created by global data
 No access control !!
Modular Programming
 namespace
 Example to learn the syntax : A toy math library.
– Matrix Module
 Allocate
 Transpose
 Print
– Vector Module
 Allocate
 Transpose
 Print
Object Oriented Programming
 Class
 Object
 Overloading (operators, functions)
 Inheritance
Class
 class : Definition of the entity
– A tool for creating new types
 Ex: Matrix and Vector
– Access Control
 public, private, and protected
– Constructors, Destructors
– Member functions
The Matrix Class Definition
class Matrix
{
private:
int **m;
public:
Matrix();
void print();
void transpose();
Matrix *transpose();
~Matrix();
}
 Access Control
 Constructor/Destructor
 Member Functions
– Ordinary Functions
– Overloaded Functions
Constructors
 Different Constructors for a class
– Matrix();
– Matrix(int init); // 0 = zero matrix, 1 = Identity!!
– Matrix(Matrix m);
Objects
 Creation
– Named object, free-store object (new & delete),
non-static member object, an array element,
temporary object, …etc
 Destruction
 Copying Objects
– Direct assignment
– Copy Constructors - Matrix::Matrix(Matrix &m);
Inheritance
 What is inheritance ?
 Parent and Derived
 Some properties of derived classes
– Constructors
– Member functions
– Overloading
Inheritance in C++
Class Rectangle : public Shape
{
}
Class Student : public Person
{
}
Public, protected and private !!
Multiple Inheritance
class Transmitter {
…
}
Class Receiver {
…
}
Class Radio : public Transmitter, public Receiver

More Related Content

DOCX
Object oriented programming tutorial
DOCX
Ppl syllabus new
PDF
Ontology matching
PPTX
General oop concepts
PPT
GATE, HLT and Machine Learning, Sheffield, July 2003
PPTX
Advanced java online training
PPTX
Introduction to oop with c++
PPT
Object oriented programming tutorial
Ppl syllabus new
Ontology matching
General oop concepts
GATE, HLT and Machine Learning, Sheffield, July 2003
Advanced java online training
Introduction to oop with c++

What's hot (6)

PPT
power poitnt of oops
PPTX
Python assignment help from professional programmers
PPT
OOP_1_TEG
PDF
Lect6-An introduction to ontologies and ontology development
PPTX
Topic Extraction on Domain Ontology
power poitnt of oops
Python assignment help from professional programmers
OOP_1_TEG
Lect6-An introduction to ontologies and ontology development
Topic Extraction on Domain Ontology
Ad

Similar to Basics of OOPs (20)

PDF
Oops concepts || Object Oriented Programming Concepts in Java
PPTX
Lecture 1.1 - Introducing Java.pptx3eeeee
PPTX
1 intro
PPTX
SE-IT JAVA LAB OOP CONCEPT
PDF
Object oriented concepts
PPTX
Chapter1 introduction
PPT
Oop by edgar lagman jr
PDF
C# Summer course - Lecture 1
PPT
Concepts In Object Oriented Programming Languages
PPTX
Introduction-to-Programming-Languages.pptx
PPT
Object-Oriented Concepts
PDF
Evolution Of Object Oriented Technology
PPTX
Introduction to Object Oriented Programming
PPTX
Programming paradigm
PDF
Object And Oriented Programing ( Oop ) Languages
PDF
conceptsinobjectorientedprogramminglanguages-12659959597745-phpapp02.pdf
PPTX
java introduction features and propertie
PPTX
Python-Classes.pptx
PPT
Oops concepts || Object Oriented Programming Concepts in Java
Lecture 1.1 - Introducing Java.pptx3eeeee
1 intro
SE-IT JAVA LAB OOP CONCEPT
Object oriented concepts
Chapter1 introduction
Oop by edgar lagman jr
C# Summer course - Lecture 1
Concepts In Object Oriented Programming Languages
Introduction-to-Programming-Languages.pptx
Object-Oriented Concepts
Evolution Of Object Oriented Technology
Introduction to Object Oriented Programming
Programming paradigm
Object And Oriented Programing ( Oop ) Languages
conceptsinobjectorientedprogramminglanguages-12659959597745-phpapp02.pdf
java introduction features and propertie
Python-Classes.pptx
Ad

Recently uploaded (20)

PDF
احياء السادس العلمي - الفصل الثالث (التكاثر) منهج متميزين/كلية بغداد/موهوبين
PDF
What if we spent less time fighting change, and more time building what’s rig...
PDF
LNK 2025 (2).pdf MWEHEHEHEHEHEHEHEHEHEHE
PPTX
Chinmaya Tiranga Azadi Quiz (Class 7-8 )
PDF
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
PDF
Empowerment Technology for Senior High School Guide
PDF
A systematic review of self-coping strategies used by university students to ...
PDF
Chinmaya Tiranga quiz Grand Finale.pdf
PDF
Computing-Curriculum for Schools in Ghana
PPTX
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
PDF
RTP_AR_KS1_Tutor's Guide_English [FOR REPRODUCTION].pdf
PDF
IGGE1 Understanding the Self1234567891011
PPTX
Orientation - ARALprogram of Deped to the Parents.pptx
PDF
Trump Administration's workforce development strategy
PDF
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
PDF
medical_surgical_nursing_10th_edition_ignatavicius_TEST_BANK_pdf.pdf
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PDF
1_English_Language_Set_2.pdf probationary
PDF
LDMMIA Reiki Yoga Finals Review Spring Summer
احياء السادس العلمي - الفصل الثالث (التكاثر) منهج متميزين/كلية بغداد/موهوبين
What if we spent less time fighting change, and more time building what’s rig...
LNK 2025 (2).pdf MWEHEHEHEHEHEHEHEHEHEHE
Chinmaya Tiranga Azadi Quiz (Class 7-8 )
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
Empowerment Technology for Senior High School Guide
A systematic review of self-coping strategies used by university students to ...
Chinmaya Tiranga quiz Grand Finale.pdf
Computing-Curriculum for Schools in Ghana
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
RTP_AR_KS1_Tutor's Guide_English [FOR REPRODUCTION].pdf
IGGE1 Understanding the Self1234567891011
Orientation - ARALprogram of Deped to the Parents.pptx
Trump Administration's workforce development strategy
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
medical_surgical_nursing_10th_edition_ignatavicius_TEST_BANK_pdf.pdf
Final Presentation General Medicine 03-08-2024.pptx
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
1_English_Language_Set_2.pdf probationary
LDMMIA Reiki Yoga Finals Review Spring Summer

Basics of OOPs

  • 1. Object Oriented Programming using C++ P.Nivetha, Dept. of BCA, Bon Secours college for Women, Thanjavur.
  • 2. Some Features of OOP languages  An OOP language should support – Easy Representation of  Real-world objects  Their States and Abilities – Interaction with objects of same type – Relations with objects of other type – Polymorphism and Overloading  Reusability of code  Convenient type definitions
  • 3. Basic Syntax  Same as C  Additional operators  Additional keywords
  • 4. Programming Paradigms  Procedural Programming (functions)  Modular Programming (namespaces)  Object Oriented Programming (classes)  Generic Programming (templates)
  • 5. Procedural Programming  A program is a list of instructions  Concentration is on what is to be done?  Problems created by global data  No access control !!
  • 6. Modular Programming  namespace  Example to learn the syntax : A toy math library. – Matrix Module  Allocate  Transpose  Print – Vector Module  Allocate  Transpose  Print
  • 7. Object Oriented Programming  Class  Object  Overloading (operators, functions)  Inheritance
  • 8. Class  class : Definition of the entity – A tool for creating new types  Ex: Matrix and Vector – Access Control  public, private, and protected – Constructors, Destructors – Member functions
  • 9. The Matrix Class Definition class Matrix { private: int **m; public: Matrix(); void print(); void transpose(); Matrix *transpose(); ~Matrix(); }  Access Control  Constructor/Destructor  Member Functions – Ordinary Functions – Overloaded Functions
  • 10. Constructors  Different Constructors for a class – Matrix(); – Matrix(int init); // 0 = zero matrix, 1 = Identity!! – Matrix(Matrix m);
  • 11. Objects  Creation – Named object, free-store object (new & delete), non-static member object, an array element, temporary object, …etc  Destruction  Copying Objects – Direct assignment – Copy Constructors - Matrix::Matrix(Matrix &m);
  • 12. Inheritance  What is inheritance ?  Parent and Derived  Some properties of derived classes – Constructors – Member functions – Overloading
  • 13. Inheritance in C++ Class Rectangle : public Shape { } Class Student : public Person { } Public, protected and private !!
  • 14. Multiple Inheritance class Transmitter { … } Class Receiver { … } Class Radio : public Transmitter, public Receiver

Editor's Notes

  • #3: Physical objects, data storage components, human entities, collections of data, components in computer games
  • #6: Functions are also referred to as subroutines, subprograms or procedures.