This document discusses object oriented programming using C++. It begins by covering topics like principles of OOP, the need for studying the subject, and how C++ overcomes the software crisis. It then discusses the software crisis in more detail, including characteristics of problematic software. The evolution of programming languages from machine code to assembly to high-level languages is examined. Finally, the document introduces C++ and how it facilitates object oriented programming to address issues with procedural programming.
C & C++ Training Centre in Ambala! BATRA COMPUTER CENTREjatin batra
Are you in search of C & C++ Training in Ambala? Now your search ends here.. BATRA COMPUTER CENTRE provides best training in:Basics of Computer, HTML,PHP,WebDesigning
Web Development , SEO, SMO and So many other courses are available here.
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
Most C++ compilers don't care what extension you give your source code, but if you don't specify otherwise, many will use .cpp by default
Most frequently used and free available compiler is GNU C/C++ compiler, otherwise you can have compilers either from HP or Solaris if you have respective Operating Systems.
C & C++ Training Centre in Ambala! BATRA COMPUTER CENTREjatin batra
Are you in search of C & C++ Training in Ambala? Now your search ends here.. BATRA COMPUTER CENTRE provides best training in:Basics of Computer, HTML,PHP,WebDesigning
Web Development , SEO, SMO and So many other courses are available here.
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
Most C++ compilers don't care what extension you give your source code, but if you don't specify otherwise, many will use .cpp by default
Most frequently used and free available compiler is GNU C/C++ compiler, otherwise you can have compilers either from HP or Solaris if you have respective Operating Systems.
Introduction to Software Engineering, Software Process, Perspective and Specialized Process Models – Introduction to Agility – Agile process – Extreme programming – XP process - Estimation-FP,LOC and COCOMO I and II,Risk Management, Project Scheduling.
In this class session, objects and classes are introduced along with a definition of what object orientated programming is. Addition topics that are covered include instantiation, reuse, encapsulation, and inheritance.
This presentation is a part of the COP2272C college level course taught at the Florida Polytechnic University located in Lakeland Florida. The purpose of this course is to introduce students to the C++ language and the fundamentals of object orientated programming..
The course is one semester in length and meets for 2 hours twice a week. The Instructor is Dr. Jim Anderson.
C++ is an Object-Oriented Programming Language which was developed by Bjarne Stroustrup at Bell Labs in the year 1980. It is based on C Language. It is created for writing programs for different purposes. It is procedural / functional / object-oriented / generic / imperative in nature. You can create Softwares and Video Games in C++. You can make Desktop Applications, GUI Applications, Game Applications, Graphic Designing Applications in C++.
Introduction to Software Engineering, Software Process, Perspective and Specialized Process Models – Introduction to Agility – Agile process – Extreme programming – XP process - Estimation-FP,LOC and COCOMO I and II,Risk Management, Project Scheduling.
In this class session, objects and classes are introduced along with a definition of what object orientated programming is. Addition topics that are covered include instantiation, reuse, encapsulation, and inheritance.
This presentation is a part of the COP2272C college level course taught at the Florida Polytechnic University located in Lakeland Florida. The purpose of this course is to introduce students to the C++ language and the fundamentals of object orientated programming..
The course is one semester in length and meets for 2 hours twice a week. The Instructor is Dr. Jim Anderson.
C++ is an Object-Oriented Programming Language which was developed by Bjarne Stroustrup at Bell Labs in the year 1980. It is based on C Language. It is created for writing programs for different purposes. It is procedural / functional / object-oriented / generic / imperative in nature. You can create Softwares and Video Games in C++. You can make Desktop Applications, GUI Applications, Game Applications, Graphic Designing Applications in C++.
Similar to Programming using C++ - slides.pptx (20)
The Roman Empire A Historical Colossus.pdfkaushalkr1407
The Roman Empire, a vast and enduring power, stands as one of history's most remarkable civilizations, leaving an indelible imprint on the world. It emerged from the Roman Republic, transitioning into an imperial powerhouse under the leadership of Augustus Caesar in 27 BCE. This transformation marked the beginning of an era defined by unprecedented territorial expansion, architectural marvels, and profound cultural influence.
The empire's roots lie in the city of Rome, founded, according to legend, by Romulus in 753 BCE. Over centuries, Rome evolved from a small settlement to a formidable republic, characterized by a complex political system with elected officials and checks on power. However, internal strife, class conflicts, and military ambitions paved the way for the end of the Republic. Julius Caesar’s dictatorship and subsequent assassination in 44 BCE created a power vacuum, leading to a civil war. Octavian, later Augustus, emerged victorious, heralding the Roman Empire’s birth.
Under Augustus, the empire experienced the Pax Romana, a 200-year period of relative peace and stability. Augustus reformed the military, established efficient administrative systems, and initiated grand construction projects. The empire's borders expanded, encompassing territories from Britain to Egypt and from Spain to the Euphrates. Roman legions, renowned for their discipline and engineering prowess, secured and maintained these vast territories, building roads, fortifications, and cities that facilitated control and integration.
The Roman Empire’s society was hierarchical, with a rigid class system. At the top were the patricians, wealthy elites who held significant political power. Below them were the plebeians, free citizens with limited political influence, and the vast numbers of slaves who formed the backbone of the economy. The family unit was central, governed by the paterfamilias, the male head who held absolute authority.
Culturally, the Romans were eclectic, absorbing and adapting elements from the civilizations they encountered, particularly the Greeks. Roman art, literature, and philosophy reflected this synthesis, creating a rich cultural tapestry. Latin, the Roman language, became the lingua franca of the Western world, influencing numerous modern languages.
Roman architecture and engineering achievements were monumental. They perfected the arch, vault, and dome, constructing enduring structures like the Colosseum, Pantheon, and aqueducts. These engineering marvels not only showcased Roman ingenuity but also served practical purposes, from public entertainment to water supply.
Synthetic Fiber Construction in lab .pptxPavel ( NSTU)
Synthetic fiber production is a fascinating and complex field that blends chemistry, engineering, and environmental science. By understanding these aspects, students can gain a comprehensive view of synthetic fiber production, its impact on society and the environment, and the potential for future innovations. Synthetic fibers play a crucial role in modern society, impacting various aspects of daily life, industry, and the environment. ynthetic fibers are integral to modern life, offering a range of benefits from cost-effectiveness and versatility to innovative applications and performance characteristics. While they pose environmental challenges, ongoing research and development aim to create more sustainable and eco-friendly alternatives. Understanding the importance of synthetic fibers helps in appreciating their role in the economy, industry, and daily life, while also emphasizing the need for sustainable practices and innovation.
Instructions for Submissions thorugh G- Classroom.pptxJheel Barad
This presentation provides a briefing on how to upload submissions and documents in Google Classroom. It was prepared as part of an orientation for new Sainik School in-service teacher trainees. As a training officer, my goal is to ensure that you are comfortable and proficient with this essential tool for managing assignments and fostering student engagement.
The Indian economy is classified into different sectors to simplify the analysis and understanding of economic activities. For Class 10, it's essential to grasp the sectors of the Indian economy, understand their characteristics, and recognize their importance. This guide will provide detailed notes on the Sectors of the Indian Economy Class 10, using specific long-tail keywords to enhance comprehension.
For more information, visit-www.vavaclasses.com
Ethnobotany and Ethnopharmacology:
Ethnobotany in herbal drug evaluation,
Impact of Ethnobotany in traditional medicine,
New development in herbals,
Bio-prospecting tools for drug discovery,
Role of Ethnopharmacology in drug evaluation,
Reverse Pharmacology.
The Art Pastor's Guide to Sabbath | Steve ThomasonSteve Thomason
What is the purpose of the Sabbath Law in the Torah. It is interesting to compare how the context of the law shifts from Exodus to Deuteronomy. Who gets to rest, and why?
1. Object Oriented Programming using
C++
• Topics to be covered in the first week
UNIT-I
• Principles of OOP: Software Crisis, Software
Evolution-Programming Paradigms, Object
Oriented Technology- Basic concepts and
benefits of OOP – Application of OOP, OOP
languages
2. Need for studying this Subject
• C++ is a programming language developed by
Bjarne Stroustrup in the year 1983.
• It overcomes the complexity in the development
of software and the developed software is easy to
maintain.
• It provides a solution to the Software Crisis
3. Software Crisis
• Software Crisis is a term used in computer science for
the difficulty of writing useful and efficient computer
programs in the required time.
• Software was too complex to develop.
The crisis manifested itself in several ways:
• Projects running over-budget
• Projects running over-time
• Software was very inefficient
• Software was of low quality
• Software often did not meet requirements
4. Characteristics of Software
• Software must be modular, easily understandable and
reusable.
• Software development cost should be minimum.
• Some may feel difficulty in coding even though they know
the solution. So Software development must be easy.
• Software should be robust as it is used in scientific and
business applications.
• The programming languages earlier to C++ could not
provide a solution to the software crisis.
5. Evolution of programming languages
Machine languages
Machine language, or machine code, is a low-level language comprised of
binary codes or codes formed using binary digits (ones and zeros).
Example :
01001000 01100101 01101100 01101100 01101111 00100000 01010111
01101111 01110010 01101100 01100100
Disadvantages :
• It is very difficult to program in machine language. The programmer has to
know details of hardware to write program and has to remember the
codes for various arithmetic and logical operations.
• The programmer has to remember too many codes to write a program. It
results in programming errors. It is difficult to debug the program also.
6. Assembly languages
As programs grew, assembly language was invented so that a
programmer could deal with larger, increasingly complex programs,
using symbolic representations of the machine instructions (ADD
R1,R2, ). User need not remember binary codes.
Disadvantages:
• It takes a lot of time and effort to write
the code for the same.
• It is very complex and difficult to
understand.
• The syntax is difficult to remember.
• It has a lack of portability of program
between different computer architectures.
Example Code:
global _main
extern _printf
section .text
_main:
push message
call _printf
add esp, 4
ret
message:
db 'Hello, World!', 10,
7. High level languages
As programs continued to grow, high-level languages were introduced
that gave the programmer more tools to handle complexity.
• The first language was FORTRAN. It was very impressive first step,
encourages clear, easy-to-understand program. But the programming
used to be monolithic.
• From 1950 onwards structured programming (blocks) and Procedure
(module/ function) oriented programming came into existence.
Instructions in the program were divided into Blocks,
modules/functions/procedures. Coding became easy as program can
be developed in small modules. A large task is divided into sub tasks
and each task is implemented using a procedure. Examples ?
8.
9. Characteristics of procedure-oriented
Programming
• Emphasis is on doing things (algorithms).
• Large programs are divided into smaller programs
known as functions.
• Most of the functions share global data.
• Data move openly around the system from function to
function.
• Functions transform data from one form to another.
• Employs top-down approach in program design.
11. • I think the most common problem is that the code does not
work according to our intention and it is very difficult to
debug.
• Some times the program does not terminate safely and the
computer gets hanged.
• Some may feel difficulty in coding even though they know
the solution.
• While developing large programs, these problems get
complicated. Several other issues will arise when we want
to develop software solutions for real world problems.
Software Crisis
12. Software for IRCTC
• Real world entities such as trains, passengers,
employees etc… must be properly represented in
programming.
• Software should be flexible to include changes made
by the Railway minister from time to time based on
the budget/ demand/profitability.
• Changes in Software must be made as fast as
possible. Cost of Software development must be
minimum.
• IRCTC Software must be robust.
13. Overview of C++
• The origin of C++
– C++ is developed by combining the best features of C
languge and SIMULA language.
– First invented by Bjarne Stroustrup in 1979 at Bell
Laboratories in Murray Hill, New Jersey.
– Initially named as “C with classes”.
– 1983 the name was changed to C++.
– Overcomes the increasing complexity in the
development of software.
14. Features of C++
• C++ facilitates object oriented programming
approach for problem solving to overcome the
disadvantages of Procedure oriented
programming approach.
• Object-Oriented Programming (OOP) is the term
used to describe a problem solving approach
based the concepts Data Abstraction, Data
Encapsulation, Inheritance and polymorphism.
• C++ provides exception handling.
15. Data Abstraction
• A programmer following the concept of data abstraction, will first
extract the crucial elements for the creation of the system, without its
implementation details.
• programmer must concentrate only on what is to be done rather than
how it needs to be done. Abstraction is a thought process, it solves
the problems at the design level.
• Programmer will focus on data first and tries to model it before he
actually starts providing the solution. He gathers all the data elements
and groups them according to their properties and behavior.
16. Example
In our real life we use abstraction in every aspect.
Take the example of Building construction.
First the engineer gives the model and then a builder starts implementing it.
it. During modeling the engineer first defines the Outer structure using most
important elements such as pillars, beams, no. of floors etc… . So an engineer first
defines the crucial elements of the system. Then he connects them to give a
overall structure to the building.
The model (also called as template) is generic and does not have
implementation details like which company cement, brand of steel, pipes. Type of
floor (tiles, ). Builder decides it according to the budget and other parameters.
The template shows important features and hides implementation details.
With that template a builder can build as many buildings as he wants by
making some changes during the implementation. Like changing color, texture of
the walls, tiles.
17. Data Abstraction
• A template can be created for any thing, not just for a
building. It can be for a car, phone, table, chair, movie or
a character in a movie .
• Template creation is followed in all manufacturing
companies.
• So why not in software companies.
• C++ language allowed programmers to create templates
before they start developing the actual software.
Programmers can create any number of templates
(classes) and they can implement these templates to
develop a program.
18. Data Abstraction using class
• In C++ there is a feature called Class which serves as a model or template.
Using Class we can model real world objects like train, employee, ticket
etc… . A train class serves as a model for all the trains running between
various stations. The train class captures the common properties of all the
trains and also their behavior.
• So while developing software for IRCTC, first we build classes(models) for
trains, employees, tickets etc.. To capture their properties and behaviour.
• Once the classes are ready, we use them to build the software by creating
as many train objects, tickets as we want.
19. Data Encapsulation
• A class is an advanced version of a structured
datatype present in C language. A structured data
type can hold only data items whereas a class can
hold dataitems and functions.
• So encapsulation binds together the data and the
functions that operate on it.
• It’s similar to a protective
wrapper that hides the code and data within the
class.
20. What Is a Class?
Low level definition)
• Class: A class in C++ is the building block, that leads to Object-
Oriented programming. It is a user-defined data type, which holds
its own data members and member functions, which can be
accessed and used by creating an instance of that class. A C++ class
is like a blueprint for an object.
• Examples : Bird, Fruit, Account,Student, Engineering, College
• Object: Any real world entity which has a name and can be
described is an entity.
• Examples: eagle, apple, sbaccount123, Chris , IT, GVPCE(A)
21. • OOP treats data as a critical element in the program
development and does not allow it to flow freely around the
system.
• It ties data more closely to the function that operate on it, and
protects it from accidental modification from outside
function.
• OOP allows decomposition of a problem into a number of
entities called objects and then builds data and function
around these objects.
• The data of an object can be accessed only by the function
associated with that object. However, function of one object
can access the function of other objects.
22. Difference between procedure oriented and
object oriented programming
• Divided Into
– In POP, program is divided into small parts called functions.
– In OOP, program is divided into parts called objects.
• Importance
– In POP, Importance is not given to data but to functions as well
as sequence of actions to be done.
– In OOP, Importance is given to the data rather than procedures
or functions because it works as a real world.
• Approach
– POP follows Top Down approach.
– OOP follows Bottom Up approach.
23. • Access Specifies
– POP does not have any access specified.
– OOP has access specifies named Public, Private, Protected, etc.
• Data Moving
– In POP, Data can move freely from function to function in the
system.
– In OOP, objects can move and communicate with each other
through member functions.
• Expansion
– To add new data and function in POP is not so easy.
– OOP provides an easy way to add new data and function.
24. • Data Access
– In POP, Most function uses Global data for sharing that can be
accessed freely from function to function in the system.
– In OOP, data can not move easily from function to function,it can be
kept public or private so we can control the access of data.
• Data Hiding
– POP does not have any proper way for hiding data so it is less secure.
– OOP provides Data Hiding so provides more security.
• Overloading
– In POP, Overloading is not possible.
– In OOP, overloading is possible in the form of Function Overloading
and Operator Overloading.
• Examples
– Example of POP are : C, VB, FORTRAN, Pascal.
– Example of OOP are : C++, JAVA, VB.NET, C#.NET.
25. Building software for
State Bank of India
• State bank of India is the largest bank in India. It has
many employees, customers, branches, assets etc..
• It gives loans, takes deposits, sells shares, bonds etc…
• Procedure oriented programming cannot be used as it
is not a simple problem. (so C language is not suitable)
• Object oriented programming is the only solution.
• In Object oriented approach the initial focus is on data.
(not the algorithm).
• First we have to identify crucial elements of the
Banking system (Data Abstraction).
26. • Loan, Deposit, Manager, Clerk, Cashier,
Branch, share, debts, assets etc…
• Identify static nature (Properties) and dynamic
nature (Behavior) of the above entities.
• Bind properties and behavior (Encapsulation)
Cashier
Name
Aadhaar Number
Service
Salary
recieveAmount()
provideAmount()
maintainBalanceSheet()
Manager
Name
Aadhaar Number
Service
Salary
IssueLoan()
IssueChequeBook()
WaiveOffoan()
availCarPetrolAllowance()
28. • Create class templates for each of these
entities in C++. (II UNIT)
• Create objects using the classes.
• Example: int x;
• Manager HyderbadBranch_Mgr,
VizagBranch_Mgr.
• Loan kingfisher_buildingConstr.
• Cashier VZNM_cashier.
29. • Write a c++ program using the relationship
between the objects.
• Reuse code by applying concepts such as
inheritance and polymorphism. (III UNIT)
• Try to identify class templates for chess game
software/ online reservation system/ library
management system/ Amazon.com
30. Features of OOPs
• Objects Ex: RVVMuraliKrishna, Mr.D.Arun Kumar
• Classes Ex: Faculty (name,service teach(), evaluate(), learn()
)
• Encapsulation (properties+behavior)
• Data abstraction (identifying crucial elements of system)
• Polymorphism ( an object exhibiting different types of behavior at
compile time or at run time)
• Inheritance
• Dynamic binding
• Message passing
31. Benefits of
Object oriented programming
• Readability of programs
• Easy to write programs
• Modularity for easier troubleshooting.
• Reuse of code through inheritance. ...
• Flexibility through polymorphism. ...
• Effective problem solving.
32. Applications of Object oriented
programming
• User interface design such as windows, menu.
• Real Time Systems.
• Simulation and Modeling.
• Object oriented databases.
• AI and Expert System.
• Neural Networks and parallel programming.
• Decision support and office automation
systems etc.
36. C++ Character Set
• The C++ character set consists of 3 main elements. They are:
• Letters: These are alphabets ranging from A-Z and a-z (both
uppercase and lowercase characters convey different
meanings)
• Digits: All the digits from 0 – 9 are valid in C++.
• Special symbols: There are a variety of special symbols
available in C++ like mathematical, logical and relational
operators like +,-, *, /, , ^, %, !, @, #, ^, &, (, ), [, ], ; and
many more.
41. Input statement in C++
cin >> variable-name;
Meaning: read the value of the variable called <variable-name> from the user
• This operator ( >> ) applied to an input stream is known as
extraction operator Extracts and parses characters sequentially from the
stream to interpret them as the representation of a value of the proper
type, which is stored as the value of val
Example:
cin >> a;
cin >> b >> c;
cin >> x;
cin >> my-character;
42. Output statements in C++
cout << variable-name;
Meaning: print the value of variable <variable-name> to the user
cout << “any message “;
Meaning: print the message within quotes to the user
cout << endl;
Meaning: print a new line
Example:
cout << a;
cout << b << c;
cout << “This is my character: “ << my-character << “ he he
he”
<< endl;
43. Hello World Program
When learning a new language, the first program people
usually write is one that salutes the world :)
Here is the Hello world program in C++.
#include <iostream.h>
int main() {
cout << “Hello world!”;
return 0;
}
44. • Using namespace std;
• We have sirnames
• Sirnames differentiate people having the same
name.
• Sirnames differentiate objects having the same
name.
• Namespaces differentiate objects having the
same name.
45. Reference variables
• A reference variable does not consume any extra
memory. It has the same memory address as the
variable it refers to. While a pointer needs extra
space for itself.
• In order to access the value of the referenced
variable using pointer, we need to use a
dereferencing operator(*) whereas we can do the
same using reference variable without any
dereferencing method.
46. • Because references must be initialized to valid
objects (cannot be null) and can not be
changed once set, references are generally
much safer to use than pointers (since there’s
no risk of dereferencing a null pointer).
However, they are also a bit more limited in
functionality accordingly. int &a=b;
• Reference variables act as shortcuts
47. Pointer Variables
• dynamic memory allocation.
• Malloc,calloc, realloc,free()
• Int *p= (int*)malloc(sizeof(int));
• Int *p=(int*) malloc(10*sizeof(int));
• new , delete
• int *p= new int; delete p;
• Int *p=new int[5];
48. Dynamic memory allocation
• Dynamic memory allocation is the process of
assigning the memory space during the execution
time or the run time.
Advantages
• When we do not know how much amount of
memory would be needed for the program
beforehand.
• When we want data structures without any upper
limit of memory space.
• When you want to use your memory space more
efficiently. Example: int Roll_Numbers[100];
50. “new” operator
• The new operator requests for the memory
allocation in heap. If the sufficient memory is
available, it initializes the memory to the
pointer variable and returns its address.
• pointer_variable = new datatype;
• pointer_variable = new datatype(value);
• pointer_variable = new datatype[size];
51. “delete” operator
• The delete operator is used to deallocate the
memory. User has privilege to deallocate the
created pointer variable by this delete
operator.
• delete pointer_variable;
• delete[ ] pointer_variable;
55. Inline functions
• In C++, we can declare a function as inline.
This copies the function to the location of the
function call in compile-time and may make
the program execution faster.
• inline returnType functionName(parameters)
{
// code
}
57. When inline functions can be used?
• For small functions we can use inline
functions. It creates faster code and smaller
executables.
• When functions are small and called very
often, we can use inline.
58. When we should avoid the use of
inline functions?
• We should not use functions that are I/O
bound as inline functions.
• When large code is used in some function,
then we should avoid the inline.
• When recursion is used, inline function may
not work properly.
59. C++ Polymorphism
• The term "Polymorphism" is the combination of
two words "poly" + "morphs" which means many
forms or many behaviours. It is a greek word.
• Real Life Example Of Polymorphism
• Let's consider a real-life example of
polymorphism. A person behaves like an
employee in office, like a father or mother at
home and as a customer in a market. Here, a
single person is behaving differently according to
the changing environments.
• There are two types of polymorphism, static and
dynamic.
60. Static polymorphism
• When the behavior changes according to the
change in environment, it is called static
polymorphism.
• Here we can identify the behaviour (functions)
of a person based on the context.
• Consider an example of a lady faculty, when
she is in college she will teach. When she is at
home she will cook.
• This is called static polymorphism.
61. Dynamic polymorphism
• Sometimes we can judge the behaviour only
after he/she does something.
• This is called dynamic polymorphism
62. Polymorphism in C++
• Strousstrup has incorporated the concept of
polymorphism in C++ programming.
• In C++ a function or an operator can exhibit
different behavior based on the environment.
• >> behaves as a Right shift operator or as an
extraction operator (input operator)
• We can also change behavior of + operator
(arithmetic operator) as a concatenation
operator when it is with the strings.
63. Examples
• A function such as sort(int a[]) can change its
behaviour and will be able to sort strings.
• So it will accept string array as input
sort(char *s[])
.
64. • The environment for a function is its
parameters. For example : add(int a, int b)
• Since a C++ compiler can know the
parameters of a functions at compile time, it
can easily determine the behavior of the
function at compile time itself.
• So static polymorphism is also called as
compile time polymorphism.
66. overloading
• In polymorphism, we are giving additional
responsibility /role to an existing operator or
function.
• So we are overloading the operator/functions
with additional responsibilities. So compile
time polymorphism is categorized into
function overloading and operator
overloading.
67. Function overloading
• Function overloading is a C++
programming feature that allows us to have more
than one function having same name but
different parameter list.
• So we can write functions with the same name
but with different logic.
source: beginnersbook.com
68. • The overloaded functions are invoked by
matching the type and number of arguments.
This information is available at the compile
time and, therefore, compiler selects the
appropriate function at the compile time.
69. • The easiest way to remember this rule is that
the parameters should qualify any one or
more of the following conditions, they should
have different type, number or sequence of
parameters.
source: beginnersbook.com