0% found this document useful (0 votes)
51 views6 pages

UNIT I C++ Notes

This document provides an overview of the C++ programming language and object-oriented programming concepts. It discusses what C++ is, why it is useful to learn, and common applications of C++ programming. It also summarizes key concepts in object-oriented programming like classes, objects, encapsulation, inheritance, and polymorphism. Finally, it describes different types of models used in object-oriented analysis and design like class models, state models, and interaction models.

Uploaded by

srmasc commerce
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
51 views6 pages

UNIT I C++ Notes

This document provides an overview of the C++ programming language and object-oriented programming concepts. It discusses what C++ is, why it is useful to learn, and common applications of C++ programming. It also summarizes key concepts in object-oriented programming like classes, objects, encapsulation, inheritance, and polymorphism. Finally, it describes different types of models used in object-oriented analysis and design like class models, state models, and interaction models.

Uploaded by

srmasc commerce
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

C++ Tutorial

UNIT I: Principles of object oriented programming, object-oriented programming paradigm.


Applications of OOPs. OOPs concepts – OOPs Languages. Models:-Class Model-State
Model and Interaction Model.

C++ is a middle-level programming language developed by Bjarne Stroustrup starting in


1979 at Bell Labs. C++ runs on a variety of platforms, such as Windows, Mac OS, and the
various versions of UNIX. This C++ tutorial adopts a simple and practical approach to
describe the concepts of C++ for beginners to advanced software engineers.

Why to Learn C++


C++ is a MUST for students and working professionals to become a great Software
Engineer. I will list down some of the key advantages of learning C++:
 C++ is very close to hardware, so you get a chance to work at a low level which gives
you lot of control in terms of memory management, better performance and finally a
robust software development.
 C++ programming gives you a clear understanding about Object Oriented
Programming. You will understand low level implementation of polymorphism
when you will implement virtual tables and virtual table pointers, or dynamic type
identification.
 C++ is one of the every green programming language and loved by millions of
software developers. If you are a great C++ programmer then you will never sit
without work and more importantly you will get highly paid for your work.
Applications of C++ Programming
As mentioned before, C++ is one of the most widely used programming languages. It has it's
presence in almost every area of software development. I'm going to list few of them here:
 Application Software Development - C++ programming has been used in
developing almost all the major Operating Systems like Windows, Mac OSX and
Linux. Apart from the operating systems, the core part of many browsers like
Mozilla Firefox and Chrome has been written using C++. C++ also has been used in
developing the most popular database system called MySQL.
 Programming Languages Development - C++ has been used extensively in
developing new programming languages like C#, Java, JavaScript, Perl, UNIX’s C
Shell, PHP and Python, and Verilog etc.
 Computation Programming - C++ is the best friends of scientists because of fast
speed and computational efficiencies.
 Games Development - C++ is extremely fast which allows programmers to do
procedural programming for CPU intensive functions and provides greater control
over hardware, because of which it has been widely used in development of gaming
engines.
 Embedded System - C++ is being heavily used in developing Medical and
Engineering Applications like software’s for MRI machines, high-end CAD/CAM
systems etc.

1
Object-oriented programming paradigm.

Object-Oriented Analysis

Object–Oriented Analysis (OOA) is the procedure of identifying software engineering


requirements and developing software specifications in terms of a software system’s
object model, which comprises of interacting objects.
The main difference between object-oriented analysis and other forms of analysis is that
in object-oriented approach, requirements are organized around objects, which integrate
both data and functions. They are modelled after real-world objects that the system
interacts with. In traditional analysis methodologies, the two aspects - functions and data
- are considered separately.
Grady Booch has defined OOA as, “Object-oriented analysis is a method of analysis
that examines requirements from the perspective of the classes and objects found in the
vocabulary of the problem domain”.
The primary tasks in object-oriented analysis (OOA) are −

 Identifying objects
 Organizing the objects by creating object model diagram
 Defining the internals of the objects, or object attributes
 Defining the behavior of the objects, i.e., object actions
 Describing how the objects interact
The common models used in OOA are use cases and object models.
Object-Oriented Design
Object–Oriented Design (OOD) involves implementation of the conceptual model
produced during object-oriented analysis. In OOD, concepts in the analysis model,
which are technology−independent, are mapped onto implementing classes, constraints
are identified and interfaces are designed, resulting in a model for the solution domain,
i.e., a detailed description of how the system is to be built on concrete technologies.
The implementation details generally include −

 Restructuring the class data (if necessary),


 Implementation of methods, i.e., internal data structures and algorithms,
 Implementation of control, and
 Implementation of associations.
Grady Booch has defined object-oriented design as “a method of design encompassing
the process of object-oriented decomposition and a notation for depicting both logical
and physical as well as static and dynamic models of the system under design”.

2
Object-Oriented Programming
Object-oriented programming (OOP) is a programming paradigm based upon objects
(having both data and methods) that aims to incorporate the advantages of modularity
and reusability. Objects, which are usually instances of classes, are used to interact with
one another to design applications and computer programs.
The important features of object–oriented programming are −

 Bottom–up approach in program design


 Programs organized around objects, grouped in classes
 Focus on data with methods to operate upon object’s data
 Interaction between objects through functions
 Reusability of design through creation of new classes by adding features to
existing classes
Some examples of object-oriented programming languages are C++, Java, Smalltalk,
Delphi, C#, Perl, Python, Ruby, and PHP.

Types of Models in Object Oriented Modeling and Design


Intention of object oriented modeling and design is to learn how to apply object -
oriented concepts to all the stages of the software development life cycle. Object-
oriented modeling and design is a way of thinking about problems using models
organized around real world concepts. The fundamental construct is the object,
which combines both data structure and behavior.
Purpose of Models:
1. Testing a physical entity before building it
2. Communication with customers
3. Visualization
4. Reduction of complexity

Types of Models:
There are 3 types of models in the object oriented modeling and design are: Class
Model, State Model, and Interaction Model. These are explained as following
below.

1. Class Model:

The class model shows all the classes present in the system. The class model
shows the attributes and the behavior associated with the objects.

The class diagram is used to show the class model. The class diagram shows the
class name followed by the attributes followed by the functions or the methods
that are associated with the object of the class. Goal in constructing class model
is to capture those concepts from the real world that are important to an
application.

3
2. State Model:

State model describes those aspects of objects concerned with time and the
sequencing of operations – events that mark changes, states that define the
context for events, and the organization of events and states. Actions and events
in a state diagram become operations on objects in the class model. State
diagram describes the state model.

3. Interaction Model:

Interaction model is used to show the various interactions between objects, how
the objects collaborate to achieve the behavior of the system as a whole.
The following diagrams are used to show the interaction model:

 Use Case Diagram


 Sequence Diagram
 Activity Diagram

Basic Concepts of Object Oriented Programming using C++

Object oriented programming is a type of programming which uses objects and


classes its functioning. The object oriented programming is based on real world
entities like inheritance, polymorphism, data hiding, etc. It aims at binding together
data and function work on these data sets into a single entity to restrict their usage.
Some basic concepts of object oriented programming are −

 CLASS
 OBJECTS
 ENCAPSULATION
 POLYMORPHISM
 INHERITANCE
 ABSTRACTION
Class − A class is a data-type that has its own members i.e. data members and
member functions. It is the blueprint for an object in object oriented programming
language. It is the basic building block of object oriented programming in c++. The
members of a class are accessed in programming language by creating an instance of
the class.
Some important properties of class are −
 Class is a user-defined data-type.
 A class contains members like data members and member functions.
 Data members are variables of the class.
 Member functions are the methods that are used to manipulate data members.
 Data members define the properties of the class whereas the member functions
define the behaviour of the class.

4
A class can have multiple objects which have properties and behaviour that in
common for all of them.
Syntax
class class_name {
   data_type data_name;
   return_type method_name(parameters);
}
Object − An object is an instance of a class. It is an entity with characteristics and
behaviour that are used in the object oriented programming. An object is the entity
that is created to allocate memory. A class when defined does not have memory
chunk itself which will be allocated as soon as objects are created.
Syntax
class_name object_name;

Encapsulation In object oriented programming, encapsulation is the concept of


wrapping together of data and information in a single unit. A formale defination of
encapsulation would be: encapsulation is binding togather the data and related function
that can manipulate the data.
Let’s understand the topic with an easy real life example,
In our colleges, we have departments for each course like computer science,
information tech. , electronics, etc. each of these departments have their own students
and subjects that are kept track of and being taught. let's think of each department as a
class that encapsulates the data about students of that department and the subjects that
are to be taught. Also a department has some fixed rules and guidelines that are to be
followed by the students that course like timings, methods used while learning, etc. this
is encapsulation in real life, there are data and there are ways to manipulate data.
Due to the concept of encapsulation in object oriented programming another very
important concept is possible, it is data abstraction or Data Hiding. it is possible as
encapsulating hides the data at show only the information that is required to be
displayed.
Polymorphism The name defines polymorphism is multiple forms. which means
polymorphism is the ability of object oriented programming to do some work using
multiple forms. The behaviour of the method is dependent on the type or the situation
in which the method is called.
Let’s take a real life example, A person can have more than one behaviour depending
upon the situation. like a woman a mother, manager and a daughterAnd this define her
behaviour. This is from where the concept of polymorphism came from.
In c++ programming language, polymorphism is achieved using two ways. They are
operator overloading and function overloading.
Operator overloading In operator overloading and operator can have multiple
behaviour in different instances of usage.

5
Function overloading Functions with the same name that can do multiple types based
on some condition.
Inheritance it is the capability of a class to inherit or derive properties or
characteristics other class. it is very important and object oriented program as it allows
reusability i.e. using a method defined in another class by using inheritance. The class
that derives properties from other class is known as child class or subclass and the class
from which the properties are inherited is base class or parent class.
C plus plus programming language supports the following types of inheritance

 single inheritance
 multiple inheritance
 multi level inheritance
 Hierarchical inheritance
 hybrid inheritance
Abstraction Data abstraction or Data Hiding is the concept of hiding data and showing
only relevant data to the final user. It is also an important part object oriented
programing.
let's take real life example to understand concept better, when we ride a bike we only
know that pressing the brake will stop the bike and rotating the throttle will accelerate
but you don't know how it works and it is also not think we should know that's why this
is done from the same as a concept data abstraction.
In C plus plus programming language write two ways using which we can accomplish
data abstraction −

 using class
 using header file

Semicolons and Blocks in C++


In C++, the semicolon is a statement terminator. That is, each individual statement
must be ended with a semicolon. It indicates the end of one logical entity.
For example, following are three different statements −
x = y;
y = y + 1;

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy