OBJECT ORIENTED PROGRAMMING WITH C++ PART - A UNIT 16 Hours Introduction: Overview of C++, Sample C++ program, Different data types, operators, expressions,

Slides:



Advertisements
Similar presentations
Object-Oriented programming in C++ Classes as units of encapsulation Information Hiding Inheritance polymorphism and dynamic dispatching Storage management.
Advertisements

Programming Paradigms Introduction. 6/15/2005 Copyright 2005, by the authors of these slides, and Ateneo de Manila University. All rights reserved. L1:
C++ Programming Languages
Overview of Data Structures and Algorithms
OBJECT ORIENTED PROGRAMMING M Taimoor Khan
ISBN Chapter 11 Abstract Data Types and Encapsulation Concepts.
Introduction to Fortran Fortran Evolution Drawbacks of FORTRAN 77 Fortran 90 New features Advantages of Additions.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Chapter 15 - C++ As A "Better C" Outline 15.1Introduction.
1 Introduction to C++ Programming Concept Basic C++ C++ Extension from C.
Chapter 13: Object-Oriented Programming
Object Oriented Databases - Overview
CSCE 110 PROGRAMMING FUNDAMENTALS WITH C++
Abstract Data Types and Encapsulation Concepts
C++ fundamentals.
Review of C++ Programming Part II Sheng-Fang Huang.
OOP Languages: Java vs C++
314450: PROGRAMMING PARADIGMS Teaching scheme: Examination Scheme: Lectures: 3 Hours/Week Theory: 100 Marks OBJECTIVE: To understand the basic building.
JAVA: An Introduction to Problem Solving & Programming, 5 th Ed. By Walter Savitch and Frank Carrano. ISBN © 2008 Pearson Education, Inc., Upper.
Comparison of OO Programming Languages © Jason Voegele, 2003.
Introduction to Object-oriented Programming CSIS 3701: Advanced Object Oriented Programming.
Programming Languages and Paradigms Object-Oriented Programming.
C++ Object Oriented 1. Class and Object The main purpose of C++ programming is to add object orientation to the C programming language and classes are.
C++ Programming. Table of Contents History What is C++? Development of C++ Standardized C++ What are the features of C++? What is Object Orientation?
Chapter 11: Inheritance and Composition. Objectives In this chapter, you will: – Learn about inheritance – Learn about derived and base classes – Redefine.
MT311 Java Application Development and Programming Languages Li Tak Sing( 李德成 )
An Object-Oriented Approach to Programming Logic and Design
UNIVERSITI TENAGA NASIONAL “Generates Professionals” CHAPTER 4 : Part 2 INTRODUCTION TO SOFTWARE DEVELOPMENT: PROGRAMMING & LANGUAGES.
CONCEPTS OF OBJECT ORIENTED PROGRAMMING. Topics To Be Discussed………………………. Objects Classes Data Abstraction and Encapsulation Inheritance Polymorphism.
Nirmalya Roy School of Electrical Engineering and Computer Science Washington State University Cpt S 122 – Data Structures Custom Templatized Data Structures.
C++
Engineering H192 - Computer Programming The Ohio State University Gateway Engineering Education Coalition Lect 24P. 1Winter Quarter C++ Lecture 24.
Copyright 2003 Scott/Jones Publishing Standard Version of Starting Out with C++, 4th Edition Chapter 13 Introduction to Classes.
CS212: Object Oriented Analysis and Design Lecture 5: Classes and Objects - II.
Programming Languages by Ravi Sethi Chapter 6: Groupings of Data and Operations.
Module 4 Part 2 Introduction To Software Development : Programming & Languages Introduction To Software Development : Programming & Languages.
C++ Programming Basic Learning Prepared By The Smartpath Information systems
ISBN Chapter 11 Abstract Data Types and Encapsulation Concepts.
Introduction to c++ programming - object oriented programming concepts - Structured Vs OOP. Classes and objects - class definition - Objects - class scope.
Learners Support Publications Object Oriented Programming.
ISBN Chapter 11 Abstract Data Types and Encapsulation Concepts.
WELCOME to III SEM Date: Class - ECE no of present : no of absent :
OOP using C Abstract data types How to accomplish the task??? Requirements Details Input, output, process Specify each task in terms of input.
Copyright © 2008 Pearson Addison-Wesley. All rights reserved. Chapter 15 Inheritance.
Introduction to OOP CPS235: Introduction.
Copyright © 2009 – Curt Hill Standard Template Library An Introduction.
1 CSE Programming in C++. 2 Overview Sign roster list Syllabus and Course Policies Introduction to C++ About Lab 1 Fill Questionnaire.
Chapter 11: Inheritance and Composition. Introduction Two common ways to relate two classes in a meaningful way are: – Inheritance (“is-a” relationship)
JAVA: An Introduction to Problem Solving & Programming, 6 th Ed. By Walter Savitch ISBN © 2012 Pearson Education, Inc., Upper Saddle River,
Chapter 20 Concepts for Object-Oriented Databases Copyright © 2004 Pearson Education, Inc.
An Introduction to Programming with C++ Fifth Edition Chapter 14 Classes and Objects.
Singleton Academy, Pune. Course syllabus Singleton Academy Pune – Course Syllabus1.
Copyright © 2012 Pearson Education, Inc. Chapter 10 Advanced Topics.
Object-Oriented Programming (OOP) and C++
1 n Object Oriented Programming. 2 Introduction n procedure-oriented programming consists of writing a list of instructions and organizing these instructions.
Lecture 2 (UNIT -1) SUNIL KUMAR CIT-UPES.
Introduction to Computers Computer Generations
INTRODUCTION TO OBJECT-ORIENTED PROGRAMMING
Sachin Malhotra Saurabh Choudhary
Abstract Data Types and Encapsulation Concepts
Programming in Java Sachin Malhotra, Chairperson, PGDM-IT, IMS Ghaziabad Saurabh Chaudhary, Dean, Academics, IMS Ghaziabad.
Object-Orientated Programming
(5 - 1) Object-Oriented Programming (OOP) and C++
Abstract Data Types and Encapsulation Concepts
More Object-Oriented Programming
(5 - 1) Object-Oriented Programming (OOP) and C++
Introduction to Data Structure
Chapter 11: Inheritance and Composition
Programming Languages and Paradigms
C++ Object Oriented 1.
Presentation transcript:

OBJECT ORIENTED PROGRAMMING WITH C++ PART - A UNIT 16 Hours Introduction: Overview of C++, Sample C++ program, Different data types, operators, expressions, and statements, arrays and strings, pointers & user defined types Function Components, argument passing, inline functions, function overloading, recursive functions UNIT 27 Hours Classes & Objects - I: Class Specification, Class Objects, Scope resolution operator, Access members, Defining member functions, Data hiding, Constructors, Destructors, Parameterized constructors, Static data members, Functions

UNIT 37 Hours Classes & Objects -II: Friend functions, Passing objects as arguments, Returning objects, Arrays of objects, Dynamic objects, Pointers to objects, Copy constructors, Generic functions and classes, Applications Operator overloading using friend functions such as +, -, pre-increment, post- increment, [ ] etc., overloading >. UNIT 46 Hours Inheritance - I: Base Class, Inheritance and protected members, Protected base class inheritance, Inheriting multiple base classes

PART - B UNIT 56 Hours Inheritance - II: Constructors, Destructors and Inheritance, Passing parameters to base class constructors, Granting access, Virtual base classes UNIT 67 Hours Virtual functions, Polymorphism: Virtual function, Calling a Virtual function through a base class reference, Virtual attribute is inherited, Virtual functions are hierarchical, Pure virtual functions, Abstract classes, Using virtual functions, Early and late binding.

UNIT 76 Hours I/O System Basics, File I/0: C++ stream classes, Formatted I/O, I/O manipulators, fstream and the File classes, File operations UNIT 87 Hours Exception Handling, STL: Exception handling fundamentals, Exception handling options STL: An overview, containers, vectors, lists, maps.

Text Books: 1.Herbert Schildt: The Complete Reference C++,4 th Edition, Tata McGraw Hill, Reference Books: 1.Stanley B.Lippmann, Josee Lajore: C++ Primer, 4 th Edition, Pearson Education, Paul J Deitel, Harvey M Deitel: C++ for Programmers, Pearson Education, K R Venugopal, Rajkumar Buyya, T Ravi Shankar: Mastering C++, Tata McGraw Hill, 1999.

DATA STRUCTURES WITH C/C++ LABORATORY Design, develop, and execute a program in C++ based on the following requirements: An EMPLOYEE class is to contain the following data members and member functions: Data members: Employee_Number (an integer), Employee_Name (a string of characters), Basic_Salary (an integer), All_Allowances (an integer), IT (an integer), Net_Salary (an integer). Member functions: to read the data of an employee, to calculate Net_Salary and to print the values of all the data members. (All_Allowances = 123% of Basic; Income Tax (IT) = 30% of the gross salary (= basic_Salary _ All_Allowance); Net_Salary = Basic_Salary + All_Allowances - IT)

Design, develop, and execute a program in C++ to create a class called STRING and implement the following operations. Display the results after every operation by overloading the operator <<. i.STRING s1 = “VTU” ii.STRING s2 = “BELGAUM” iii. STIRNG s3 = s1 + s2; (Use copy constructor)

Design, develop, and execute a program in C++ to create class called STACK using an array of integers and to implement the following operations by overloading the operators + and - : i. s1=s1 + element; where s1 is an object of the class STACK and element is an integer to be pushed on to top of the stack. ii.s1=s1- ; where s1 is an object of the class STACK and - operator pops off the top element. Handle the STACK Empty and STACK Full conditions. Also display the contents of the stack after each operation, by overloading the operator <<.

Design, develop, and execute a program in C++ to create a class called LIST (linked list) with member functions to insert an element at the front of the list as well as to delete an element from the front of the list. Demonstrate all the functions after creating a list object

Design, develop, and execute a program in C++ to create a class called DATE with methods to accept two valid dates in the form dd/mm/yy and to implement the following operations by overloading the operators + and -. After every operation the results are to be displayed by overloading the operator <<. i. no_of_days = d1 - d2; where d1 and d2 are DATE objects, d1 >=d2 and no_of_days is an integer. ii.d2 = d1 + no_of_days; where d1 is a DATE object and no_of_days is an integer.

13. Design, develop, and execute a program in C++ to create a class called OCTAL, which has the characteristics of an octal number. Implement the following operations by writing an appropriate constructor and an overloaded operator +. i.OCTAL h = x ; where x is an integer ii.int y = h + k ; where h is an OCTAL object and k is an integer. Display the OCTAL result by overloading the operator <<. Also display the values of h and y.

Design, develop, and execute a program in C++ to create a class called BIN_TREE that represents a Binary Tree, with member functions to perform inorder, preorder and postorder traversals. Create a BIN_TREE object and demonstrate the traversals.

Overview of C++ The origin of C++ –Expanded version of C. –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. –Undergone three major revisions. The first version in 1985 Second in Third occurred during standardization of C++.(ANSI/ISO committee)

What is object-oriented programming? When computers were first invented, programming was done by toggling in the binary machine instructions using the computer’s front panel. As long as programs were just a few hundred instructions long, this approach worked. 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.

As programs continued to grow, high-level languages were introduced that gave the programmer more tools with which to handle complexity. The first language was FORTRAN. It was very impressive first step, encourages clear, easy-to- understand program. The 1960s gave birth to structured programming which is encouraged by languages such as C and Pascal. It made the moderately complex programs fairly easily. But structured approach no longer worked for greater complex programming

Object Oriented methods were created to face such types of problems. OO programming took the best ideas of structured programming and combine them with several new concepts.

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.

Access Specifiers –POP does not have any access specifier. –OOP has access specifiers 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.

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.

Features of OOPs Objects Classes Encapsulation Data abstraction Polymorphism Inheritance Dynamic binding Message passing