Download presentation
Presentation is loading. Please wait.
1
C++
2
CHAPTER 1 INTRODUCTION
3
Session Objectives Introduction to Objects Define Class & Objects
Characteristics of OOPS History of C++ Difference Between C & C++ C++ Programming Structure
4
All around us in the real world are objects.
Each object has certain characteristics and exhibits certain behaviour
5
Object Oriented Programming
Based On OOP's Concept Object Oriented Programming
6
OBJECT Data Color : Black Year : 2008 Actions Start Stop Accelerate
7
The Object-Oriented Approach - III
Sales Accounts Personnel The real world around is full of objects .We can consider both living beings as well as things as objects.For example,the different departments in a company are objects.
8
Why OOP’s Concept are Used?
The drawbacks of Traditional Programming approach are Unmanageable Programs Code Reusability not Optimum Problems in Modification of Data Difficulty in Implementation
9
Object – Oriented Programming
Here the application has to implement the entities as they are seen in real life and associate actions and attributes with each. Accounts Data Employee details Salary statements Bills Vouchers Reciepts Functions Calculate salary Pay salary Pay bills Tally accounts Transact with banks
10
Benefits of Object Oriented Programming approach are -
OOP offers better implementation OOP offers better data security OOP offers better code reusability OOP offers more flexibility OOP offers better manageable programs Large complexity in the software development can be easily managed User defined datatypes can be easily constructed
11
Object Oriented Approach
Problem Identification Analysis Maintenance Design Implementation Development Testing
12
APPLICATIONS OF OOP's Data acquisition Systems Client/Server Computing
Object –Oriented Database applications Artificial Intelligence and expert systems systems such as process control, temperature control etc. GUI based system such as Windows Applications Computer Aided Design and manufacturing Systems
13
Characteristics of Oops
Encapsulation Data Abstraction Inheritance Polymorphism Class
14
Encapsulation Grouping of data and methods into a single entity is known as Data Encapsulation It is a technical name for information hiding. (i.e data hiding or data security)
15
Encapsulation Class Private Not accessible from outside class
Public
16
Abstraction Data abstraction enhances security as use of data is restricted to certain functions only. Abstraction is more used where you want only a certain number of functions/methods are accessing data.
17
For Example Class Attributes Methods
Data abstraction is a process of identifying properties and methods related much to a particular entity as relevant to the application Class Attributes Methods
18
It is the process of creating a new class from an existing class
Inheritance It is the process of creating a new class from an existing class
19
Reusability can be achieved through inheritance
Animals Insects Mammals Reptiles Amphibians Humans Non-Humans
20
Reusability Programs can be broken into reusable objects Shape
Existing classes can be used with additional features Shape
21
Benefits of Inheritance
Software Reuse Code Sharing Improved Reliability Rapid Prototyping
22
Polymorphism polymorphism allows a programmer to purse a course of action by sending a message to an object without concerning about how the software system is to implement the action Simply defined as “Same thing can behave different ones”
23
Class - Artiste Dancer Poet Sculptor
Class : Shape Methods : Draw Move Initialize Subclasses
24
Classes A class is what defines all the data members and the methods that an object should have. The class defines the characteristics that the object will possess; it could also be referred to as a blueprint of the object.
25
Properties Vertices Border Color Fill Color Methods Draw Erase Move
For Example Polygon objects Polygon class Properties Vertices Border Color Fill Color Abstract Methods Draw Erase Move into
26
CLASS + DATA FUNCTION Simply defined as a structure that combines the objects with some attributes (data structure) and some behavior (operation)
27
Access Specifiers of a Class
Not accessible from outside the class Private Data or functions Public Accessible from outside the class Data or functions
28
To access the member data and member function defined inside the class
C++ OBJECT To access the member data and member function defined inside the class
29
Object Oriented Languages
Some of the leading object oriented languages are: C++ Smalltalk Eiffel CLOS Java
30
HISTORY OF C++ Author of C++ is Bjarne stroustrup He invented this language in 1980's at AT&T Bell Laboratories All the C programs can be run successfully using C++ compiler
31
ORIGIN OF C++ C++ was designed using two languages such as “C” Language which gives the low-level feature and “Simula67” provides the class concept.
32
DIFFRERENCE BETWEEN C & C++
C Language C++ Language Procedural Programming Language Object Oriented Programming Language Headerfile : #include<stdio.h> #include<iostream.h> “\n” is used to go to the next line we can use endl statement Function prototypes are optional All Functions must be protyped Local variables declared only the start of a C program It can be declared anywhere in a program, before they are used Return type for a function is optional Return type must be specified Do not permit data Hiding They permit data hiding Bydefault structure members are public class members are private We can call a main() function within a program This is not allowed
33
Summary Each class specification starts with the keyword “class”
The Class Specification must always end with a semicolon (;) Data abstraction is the ability to create user-defined data types for modeling real world objects using built-in data types. Classes are used for data abstraction by hiding the implementation of a type in the “private” part. Polymorphism in Greek word means “Many Forms”
34
Summary A class is an enhanced structure that provides Object-Oriented Features of C++ An object is an instance of a class which combines both data and functions together. Encapsulation is the process of combining member functions and the data it manipulates and keeps them safe from outside interferrence The three access specifiers in a class are private,public,protected By default all members declared inside a class are private to that class C++ provides two pre-defined objects cin and cout for handling input and output
35
EXERCISES Describe the Basic concepts of OOPS?
List the various applications of Object oriented Programming? Explain briefly Classes & Objects? State the use of #include directive in C++? List the various benefits of Object Oriented Programming?
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.