Prof. Bhushan Trivedi Director GLS Institute of Computer Technology

Slides:



Advertisements
Similar presentations
The C ++ Language BY Shery khan. The C++ Language Bjarne Stroupstrup, the language’s creator C++ was designed to provide Simula’s facilities for program.
Advertisements

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.
1 Introduction to C++ Programming Concept Basic C++ C++ Extension from C.
Guide To UNIX Using Linux Third Edition
WEL COME PRAVEEN M JIGAJINNI PGT (Computer Science) MCA, MSc[IT], MTech[IT],MPhil (Comp.Sci), PGDCA, ADCA, Dc. Sc. & Engg.
Abstract Data Types and Encapsulation Concepts
 2007 Pearson Education, Inc. All rights reserved C++ as a Better C; Introducing Object Technology.
C++ fundamentals.
Distribution of Marks Internal Sessional Evaluation Assignments – 10 Quizzes – 10 Class Participation Attendence – 5 Mid – Term Test – 25 External Evaluation.
OBJECT ORIENTED PROGRAMMING IN C++ LECTURE
COMPUTER PROGRAMMING. Introduction to C++ History Merges notions from Smalltalk and notions from C The class concept was borrowed from Simular67 Developed.
UFCEUS-20-2 : Web Programming Lecture 5 : Object Oriented PHP (1)
Java Beans.
 2008 Pearson Education, Inc. All rights reserved Introduction to Computers, the Internet and World Wide Web.
Introduction to Object-oriented programming and software development Lecture 1.
GENERAL CONCEPTS OF OOPS INTRODUCTION With rapidly changing world and highly competitive and versatile nature of industry, the operations are becoming.
Object Oriented Programming Elhanan Borenstein copyrights © Elhanan Borenstein.
Copyright 2003 Scott/Jones Publishing Standard Version of Starting Out with C++, 4th Edition Chapter 13 Introduction to Classes.
C++ History C++ was designed at AT&T Bell Labs by Bjarne Stroustrup in the early 80's Based on the ‘C’ programming language C++ language standardised in.
Copyright 2004 Scott/Jones Publishing Alternate Version of STARTING OUT WITH C++ 4 th Edition Chapter 7 Structured Data and Classes.
Prepared by: Elsy Torres Shajida Berry Siobhan Westby.
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.
Object-Oriented Programming Chapter Chapter
Principles of programming languages 10: Object oriented languages Isao Sasano Department of Information Science and Engineering.
1 CS Programming Languages Class 22 November 14, 2000.
ISBN Chapter 11 Abstract Data Types and Encapsulation Concepts.
Object-Oriented Programming (OOP) and C++
1 C++ Classes & Object Oriented Programming Overview & Terminology.
Chapter 15 - C++ As A "Better C"
Programming with ANSI C ++
The Object-Oriented Thought Process Chapter 03
Motivation for Generic Programming in C++
Inheritance Modern object-oriented (OO) programming languages provide 3 capabilities: encapsulation inheritance polymorphism which can improve the design,
Principles of programming languages 10: Object oriented languages
Inheritance Chapter 7 Inheritance Basics Programming with Inheritance
Visit for more Learning Resources
Programming with ANSI C ++
Programming with ANSI C ++
INTRODUCTION TO OBJECT-ORIENTED PROGRAMMING
Programming with ANSI C ++
Abstract Data Types and Encapsulation Concepts
Programming with ANSI C ++
Object-Oriented Programming (OOP) Lecture No. 45
Java Programming: Guided Learning with Early Objects
Object-Oriented Database Management System (ODBMS)
11.1 The Concept of Abstraction
Overview of C.
Inheritance Modern object-oriented (OO) programming languages provide 3 capabilities: encapsulation inheritance polymorphism which can improve the design,
INTRODUCTION TO OBJECT-ORIENTED PROGRAMMING (OOP) & CONCEPTS
PRINCIPALES OF OBJECT ORIENTED PROGRAMMING
Introduction to C Programming Language
C++ History C++ was designed at AT&T Bell Labs by Bjarne Stroustrup in the early 80's Based on the ‘C’ programming language C++ language standardised in.
CS212: Object Oriented Analysis and Design
(5 - 1) Object-Oriented Programming (OOP) and C++
Abstract Data Types and Encapsulation Concepts
Programming with ANSI C ++
File Systems and Databases
Abstract Data Types and Encapsulation Concepts
Object Oriented Programming: Inheritance
Programming with ANSI C ++
(5 - 1) Object-Oriented Programming (OOP) and C++
Object-Oriented Programming: Inheritance and Polymorphism
Chapter 9 Inheritance.
Object-Oriented PHP (1)
11.1 The Concept of Abstraction
Chapter 11 Abstraction - The concept of abstraction is fundamental in
Presentation transcript:

Prof. Bhushan Trivedi Director GLS Institute of Computer Technology Programming with ANSI C ++ A Step-by-Step Approach Prof. Bhushan Trivedi Director GLS Institute of Computer Technology

Introduction to Object-Oriented Programming and C ++ Chapter 1 Introduction to Object-Oriented Programming and C ++

Agenda Limitations of C The Object Orientation C++ and the Object Orientation Is C++ a completely object oriented language? The Classes and Objects

Agenda Differences between C and C++ Philosophical differences Syntactical differences Capability to provide Object Based and Object Oriented programming both The Exception based design of code

Agenda Introduction of template as generic programming element Introduction to the C++ Object Mode Variations of C++ The Applications of C++

The strength of C very powerful and proven. survived for more then two decades efficient and compact programs C programs executables produce most compact object code

The strength of C C is being used in small and medium size programs to a great extent. There is a large class of programmers just know one language, The C.

The strength of C Operating systems like Linux and Windows, Databases like Oracle, Network programs like TCP/IP all of them have large (if not all!) part of them written in C. (Though significant part of them is written in C++ as well

Limitations of C Problems are apparent while attempting large programs Very large C programs loose a ‘Global View’ Very difficult to remember every part of the program Problem with the design

Limitations of C Problem with the inability of the language to express Intermediate solution is to make the program modular Modules are not totally independent Efficient teamwork is impossible without global vision

The Remedy Ability to have a global view using abstractions Relieved from the burden of handling a large program View as a program with few abstractions Can view the entire program together Can properly reason if a part of it to be debugged and modified.

Solution in the design We may need to add new features in the programming language (here the C) to suit very large programs (which C++ does). We may even require changing the style of programming (which C++ does not do, we have to do it)

Solution by the design We may need to change the process of viewing the problem itself The software engineering process

OB and OO programming New designs of programming Object Based (less flexible but more efficient) Object Oriented (more flexible but less efficient)

OB and OO programming Programming is to provide computer-based solutions to real world problems Entities, attributes; what they do? Visualizing and programming the problem in global way

OB and OO programming Need for providing abstractions (class) for all the entities involved in the process. OB or OO programming preserves the global view even when program grows

The philosophy Designed for providing both Object Based and Object Oriented programming Keeping backward compatibility with C keeping efficiency levels of C The object-oriented model is not imposed on the developer like Java Reusability advantage using STL

The Classes and Objects C++ introduces a new element, called class; which is an extension to struct, and provides us the facility to store actions in form of functions within the entities themselves. Variable of type class is known as object

The Classes and Objects The data and function members of a class The operations by and on the objects The thin class design vs Abstract Data Type design Class is a sketch from where actual objects are derived

The member functions The non member function are also possible! StudentPrintDetails(Lara),StudentPrintDetails(Mahesh) and StudentPrintDetails(Moti) Lara.PrintDetails() (allowed) and Moti.PrintDetails() (not allowed) The objects of the class only can operate on the functions owned by them

Difference between C and C++: Philosophical differences The C++ is not just Extended C, the program design changes radically The principle of information hiding Public and private division The inheritance advantage MFC(OO) and STL(OB) examples Similarity of user defined types with built-in

The Constructor example class student { int roll_no; … student() // this is a construction function, bearing same name as a class { roll_no = 0; } }; student st1;

Operator overloading Assume Complex to be a class defined earlier Complex C1, C2, C3; C1.SetValues(2,3);//i.e. 2+3i C2. SetValues(3,4); //i.e. 3+4i

Operator overloading Now we can write following C3 = C1 + C2; This shows the operator + overloaded for class Complex

The Syntactical Differences: the comment // /*This itself is c like comment, while following is a C++ like comment*/ if (a>b) // checking for a greater then b printf (“A is greater!); if (a>b) /* checking for a > b!*/ printf(“a is bigger!”); IS NOT REPLACABLE!

The IO Operators cout << “a is greater”; cin >> StringVariable We do not need to provide data type with cin or cout (like %d, %s etc) We do not need to append & operator in front of variable like scanf while reading a variable value

Other Differences Return types are different Default return type is void and not int Compiling under different compilers is different Exception based design Templates as type-less way of writing code. Type is an argument to be passed to templates at the time of definition

The C++ Object Model How the program is compiled to object code is designed by this model This is not part of the standard! So every compiler may prefer to do it deems fit It is important to know how object model works to understand the working of a program The prime emphasis is on efficiency and not flexibility

Variations of C++ The C++ originally designed by Bjarne Staroustrup in 1979(“C with classes”) The incremental operator ++ was added in 1983 to the ‘C’ Intermediate incompatible versions ANSI / ISO standardization committee provided an ANSI/ISO C++ standard looking at all these changes in 97

Applications of C++ Operating systems Middle tire in Microsoft Tech applications Computer Graphics Programming Network devices VOIP (Voice over IP) Web search engines RDBMS, ERP and CRM products base part