PDF nptel,mechanical engineering nptel,nptel -V121 - GRID - ETSI - C++ Programming Slides from INFOSYS 01
Wait Loading...


PDF :1 PDF :2 PDF :3 PDF :4 PDF :5 PDF :6 PDF :7 PDF :8 PDF :9


Like and share and download

C++ Programming Slides from INFOSYS 01

V121 - GRID - ETSI

PDF 1 of 34 Infosys Campus Connectcampusconnect infosys Inspire Briefing PPT V3 pdf PDF faculty institution infosys Infosys Campus Connectcampusconnect infosys homedownloads Briefing 20Kit1 pdf PDF Programming In C Developers Library Stephen G Book

Related PDF

1 of 34 - Infosys Campus Connect

[PDF] 1 of 34 Infosys Campus Connectcampusconnect infosys Inspire Briefing PPT V3 pdf
PDF

faculty institution infosys - Infosys Campus Connect

[PDF] faculty institution infosys Infosys Campus Connectcampusconnect infosys homedownloads Briefing 20Kit1 pdf
PDF

Programming In C Developers Library Stephen G - Book library

[PDF] Programming In C Developers Library Stephen G Book library tesseract cl programming in c developers library stephen g kochan pdf
PDF

PDF 1889 kbytes - Computer Science & Engineering

[PDF] PDF 1889 kbytes Computer Science & Engineering cse lehigh edu ~lopresti Talks 2007 RecruitingTalk pdf
PDF

0b Index Page - nptel

[PDF] 0b Index Page nptel nptel ac in media pdf nptel 2018 booklet pdf
PDF

D21: TANGO Requirements and Architecture Specification Alpha

[PDF] D2 1 TANGO Requirements and Architecture Specification Alpha tango project eu D2 1 TANGO 20Requirements 20and 20Architecture 20Specification 20
PDF

Faculty of Computer Science and Applications - CHARUSAT

[PDF] Faculty of Computer Science and Applications CHARUSAT charusat ac in BCA CBCS Syllabus W E F 2018 BCA 2018 Batch Revised Humanities pdf
PDF

devops and microservices - IEEE Computer Society

[PDF] devops and microservices IEEE Computer Society puter web csdl index csdl mso201603 issue pdf
PDF

V121 - GRID - ETSI

8 Apr 2010 Presentation slides at the "II Göttinger IETF RFC 2743 "Generic Security Service Application Program Interface Version 2, Update 1" [i 52] IETF RFC The TC is standardizing C and C++ use within an SCA domain for SOA InfoSys, Catalogs globus−jobmanager job mgr perl script gridftpd LCG
PDF

C Programming

The Basics of C Programming - University of Connecticut

kciti edu wp content uploads 2017 07 cprogramming About The Tutorial C is a general purpose, procedural, imperative computer programming language developed in 1972 by Dennis M Ritchie at the Bell Telephone Laboratories to develop the UNIX operating system C is the most widely used computer language

C Programming

Introduction to C Programming

PDF C Programming Tutorial unf edu ~wkloster 2220 cprogramming tutorial pdf PDF C Programming Tutorial phy ntnu edu tw ~cchen pdf ctutor pdf PDF C Programming Tutorial Mark Burgessmarkburgess CTutorial C

  1. c programming examples pdf
  2. easy way to learn c programming language pdf
  3. practical c programming pdf
  4. c programming exercises pdf
  5. learn c programming step by step pdf
  6. c programming tutorial
  7. c programming language pdf for beginners
  8. c programming book pdf free download

c++ programs class 11

Chapter 11 structs (C++ records)

application such as a C++ program that uses the String class is a client 11 Give an example of how the keyword inline is used to declare as inline a method Chapter 11, Bit Operations, discusses the logical C++ operators that work on

  1. Applications Programming in C++
  2. Practical C++ Programming
  3. simplifying the analysis of c++ programs
  4. Class
  5. Practical C++ Programming Teacher's Guide
  6. The C++ Language Tutorial
  7. Learn C++ Programming Language
  8. A Complete Guide to Programming in C++
  9. Chapter 11 structs
  10. C++ records

C++ Programs Collection

Chapter 11 structs (C++ records)

, the Wikibooks Java Programming and C Programming, C++ Exercises for collection, while C++ relies mainly on the RAII (Resource Acquisition Is  It is one of the simplest programs that can be written in C++, but it already contains the fundamental components that every C++

  1. C++ Programming
  2. collection of open
  3. The C++ Language Tutorial
  4. Guidelines for C++ Program Style
  5. C++ Programming HOW-TO
  6. Introduction to C++
  7. Programming
  8. oriented class library for C++ programs
  9. Quantifying Behavioral Differences Between C and C++ Programs
  10. Accelerated C++ Practical Programming by Example

C Programs

Model Checking C Programs with MSVL

PDF C Programs with Solutions skiet downloads cprogrammingquestion pdf PDF C Programming kciti kciti edu wp content uploads cprogramming tutorial pdf PDF Dr Estell's C Programs and Examples Last modifiedweb ipac caltech edu staff fmasci

  1. basic c programs for beginners pdf
  2. learn c programming step by step pdf
  3. c programs pdf
  4. c programming lecture notes
  5. c programming language pdf for beginners
  6. c programming book pdf free download
  7. practical c programming pdf
  8. easy way to learn c programming language pdf

C++ Project Class 12

Mini Project Report - Northwestern University

centercomp biology projects for class 12 pdf Biology Projects for Class 12 CBSE High School Students The Biology Project, an interactive online resource for learning biology developed at The University of Arizona The Biology Project is fun, richly illustrated, and tested on 1000s of students It

c++ project on library management by kc

1 periodic table in c++ 2 class result analysis 3 library

Library management system is a project which aims in developing a computerized system to maintain all the daily work of library This project has many features Nov 15, 2011 You can build library management system on your own Do not submit project with

  1. Library Management System
  2. The Library Management System
  3. KEY ACADMIC PROJECTS Library Management
  4. C++ Project
  5. library management system by adebesin tobi tosin
  6. Open source library management system
  7. Online Library Management System
  8. Chapter 3 Survey of open source library management systems
  9. Improving Design of Library Management System using Design
  10. periodic table in c++ 2

c question and answerr

C Interview Question Answer

PDF C Language Questions and Answers Techtud techtud C 20Language 20100 20Questions 20Answers pdf PDF C Programs with Solutions skiet downloads cprogrammingquestion pdf PDF C Programming Question And Answer The Right

  1. c interview question with answer pdf
  2. tough c interview questions
  3. c pointers interview questions and answers pdf
  4. c++ question and answer pdf
  5. function in c programming questions and answers
  6. c programming basic questions pdf
  7. c programming final exam questions and answers
  8. c interview questions tutorialspoint

C.S. Lewis - Crestinism Pur Si Simplu

Mai presus de simplul creştinism - islam chat

Home back Next

gramming Slides from INFOSYS 01

Description

Object-Oriented Programming using C++

Course Objectives •

To recall the concepts of object oriented programming

To motivate towards Object Oriented Approach of problem solving

To introduce the implementation issues of Basic Object Oriented Concepts in a programming language like C++

To enable the participants to write application programs using the object oriented features of C++

To introduce advanced features of C++ like Templates,

Copyright © 2006,

Infosys Technologies Ltd

ER/CORP/CRS/LA38/003 Version no: 1

Evaluation Components: •

Test on Day 7

Project submission on Day6 (LC only)

Submission of Assignments is mandatory to take up the Module Test

Copyright © 2006,

Infosys Technologies Ltd

ER/CORP/CRS/LA38/003 Version no: 1

References • Brad J

Andrew J

Novobilski Object-Oriented Programming – An evolutionary approach,

Addison-Wesley,

Rumbaugh,

Premerlani,

Lorensen

Objectoriented modeling and design

Prentice-Hall,

Englewood Cliffs,

Object-oriented analysis and design with applications

Benjamin/Cummings,

Redwood City,

Robert Lafore,

Object oriented programming in C++,

Galgotia Publications

Yashavant Kanetkar,

Let us C++,

BPB publications

Herbert Schieldt,The Complete Reference C++,Tata McGraw Hill Publications

Bjarne Stroustrup,

The C++ Programming Language,

AddisonWesley

Copyright © 2006,

Infosys Technologies Ltd

ER/CORP/CRS/LA38/003 Version no: 1

Session Plan

Programming Techniques Introduction to Object Oriented Concepts Basics of C++ Reference Variables Parameter Passing techniques Abstract Data types Classes and Objects Access Specifiers Class – Best Practices and Guidelines Constructors and Destructors

Copyright © 2006,

Infosys Technologies Ltd

ER/CORP/CRS/LA38/003 Version no: 1

Programming Techniques •

Unstructured – Sequence of instructions,

which manipulated global data – As size increases,

code becomes more complex to maintain

Procedural Programming – Brought in Modularity in coding,

enhancing maintainability – Common functionalities grouped into separate modules – Complexity made manageable by hiding complexity inside functions Introduced the concept of structures (also known as data structures)

Object Oriented Programming – Data structures combined with relevant functions to create reusable objects – Focus of this course

Copyright © 2006,

Infosys Technologies Ltd

ER/CORP/CRS/LA38/003 Version no: 1

Procedural versus Object Oriented Programming • •

In procedural programming,

functions operate based on either local or global data In Object oriented programming,

Objects exist and objects interact with other objects

Copyright © 2006,

Infosys Technologies Ltd

ER/CORP/CRS/LA38/003 Version no: 1

Object Oriented Concepts •

Abstraction: Process of forming of general and relevant information from a complex scenarios

Encapsulation: Localization of information within an object

This also leads to Information Hiding

Inheritance: Is a process by which one object acquires the properties of another object

Polymorphism: allows the programmer to use “one interface” for “many functions”

Copyright © 2006,

Infosys Technologies Ltd

ER/CORP/CRS/LA38/003 Version no: 1

Basics of C++ • • • •

C++ is an Object Oriented programming language It can be considered as a super set of C This enables backward compatibility Bjarne Stroustrup first invented “C with Classes” and then it was renamed to C++ in 1983

Advanced Features

Object Oriented Features

C Language

Copyright © 2006,

Infosys Technologies Ltd

ER/CORP/CRS/LA38/003 Version no: 1

Basics of C++ Comments • •

C++ style comments are single line comments C++ also supports C Style comments (backward compatibility with C)

C- Style Comments: /* C- Style Single Line Comment*/ /******************************************************** * This is C Style Multiple Line Comment * Used for Function Headers ********************************************************/

C++ Style Comments: // This is a single line comment Copyright © 2006,

Infosys Technologies Ltd

ER/CORP/CRS/LA38/003 Version no: 1

Data types of C++ Data Types

User defined types

Derived types

Built-in types

Copyright © 2006,

Infosys Technologies Ltd

ER/CORP/CRS/LA38/003 Version no: 1

Variables and naming convention • • • •

Variables can be declared anywhere in the program,

just before it is used The naming convention followed for the variables need to be consistent and meaningful Hungarian Notation must be followed similar to C for variable naming conventions All primitive C Data types are supported in C++ due to backward compatibility

Prefix i f d'l'c ai af ad al ac

Data Type

Example

int and unsigned int float double long and unsigned long signed char and unsigned char Array of integers Array of float Array of double Array of long integers Array of characters

Copyright © 2006,

Infosys Technologies Ltd

iTotalMarks fAverageMarks dSalary lFactorial cChoice aiStudentId afquantity adAmount alSample acEmpName

ER/CORP/CRS/LA38/003 Version no: 1

Control Structures •

Control Structures are statements which changes the execution sequence of the program

C++ supports all the control structures supported in C – – – – –

else switch case for loop while loop do while

Copyright © 2006,

Infosys Technologies Ltd

ER/CORP/CRS/LA38/003 Version no: 1

Operators Common in C and C++ • • • • • • • • • • •

Arithmetic operators +,

% Pre and Post Unary Operators ++,

Copyright © 2006,

Infosys Technologies Ltd

ER/CORP/CRS/LA38/003 Version no: 1

Operators in C++ •

Scope Resolution Operator ( ::)

Memory Allocation/De-allocation operator (new and delete)

Member Access operators (

Reference Operator ( & )

Insertion and Extraction Operators ( > )

Copyright © 2006,

Infosys Technologies Ltd

ER/CORP/CRS/LA38/003 Version no: 1

Scope Resolution Operator (::) • •

Used for resolving the scope of the variables Used for defining methods outside the class declaration # include int iNum=10

int main(int argc,char** argv) { int iNum=20

} printf("\n%d %d",iNum,::iNum)

Infosys Technologies Ltd

ER/CORP/CRS/LA38/003 Version no: 1

Reference Variables • • • • •

Reference variable is an alias created for an already existing variable

Change in reference will change the value of the variable and vice versa Should be initialized when declared and cannot be reinitialized A variable can have multiple reference Array of reference is not allowed int main(int argc,char** argv) { int iNum=10

/* Declare and initialize reference variable */ int& riNum = iNum

Infosys Technologies Ltd

ER/CORP/CRS/LA38/003 Version no: 1

Parameter Passing Techniques

} void SwapByRef(int& riVal1,int& riVal2){ int iTemp

Copyright © 2006,

Infosys Technologies Ltd

void SwapByValue(int iVal1,int iVal2){ int iTemp

} int main(int argc,char** argv) { int iNum1=10,iNum2=20

printf(“%d %d”,iNum1,iNum2)

SwapByAdd(&iNum1,&iNum2)

ER/CORP/CRS/LA38/003 Version no: 1

Functions

Referencing Offers a clean,

elegant and efficient way to pass parameters to functions that changes the value of actual parameter Difficulty in de-referencing is eliminated in pass by reference Calling syntax is much simpler compared to call by address Pass by Reference needs no memory

Copyright © 2006,

Infosys Technologies Ltd

ER/CORP/CRS/LA38/003 Version no: 1

Structures in C • • • • • •

Composite data type Contains one or more logically related data (similar or dissimilar) grouped together under a single name for convenient handling Variables declared inside structure are called fields or members Functions cannot be part of Structure Structure variables can be created using structure name

Members can be accessed using

iEmpId=43002 E1

fBasic=2500

fTotSal=E1

fBasic+300

Copyright © 2006,

Infosys Technologies Ltd

ER/CORP/CRS/LA38/003 Version no: 1

Structures in C++ • • •

C++ extends the features of C Structures C++ structures can have functions as its members

Default access specifier for Structure members is “public”

Access specifiers will be dealt in later slides

struct _employee { int m_iEmpId

void CalculateSal() { /* Code for sal calculation */ } }

struct { private: /* private data member and methods */ protected: /* protected data member and methods */ public: /* public data member and methods */ }

Copyright © 2006,

Infosys Technologies Ltd

ER/CORP/CRS/LA38/003 Version no: 1

Class • • • • • •

Basic unit of abstraction in C++ Extension of the concept of structures Provides a technique to bind data and functions together (Encapsulation) Data Members – Variables declared inside the class Member Functions – Functions declared/defined inside the class Member Functions are also called as Methods

public: void CalculateSal() { /* Code for sal calculation */ } }

class { private: /* private data member and methods */ protected: /* protected data member and methods */ public: /* public data member and methods */ }

Copyright © 2006,

Infosys Technologies Ltd

ER/CORP/CRS/LA38/003 Version no: 1

Class – Implementation of Encapsulation (Access Specifiers) •

Public Members – Accessed within and outside the class

Protected Members – Accessed within and only by derived classes

Private Members

No Entry

– Accessed only within the class

Good design practice is to keep data members under private and methods under public Methods invoked ONLY by other methods of the same class are kept private Such methods are called helper methods Copyright © 2006,

Infosys Technologies Ltd

Private Members Restricted Entry

Protected Members for Derived Class

Entry for All

Public Members

ER/CORP/CRS/LA38/003 Version no: 1

Objects • • • • • • •

Instance of a class in memory Unique,

self – contained entity that contains attributes and behaviors If class is viewed as a data type then object can be considered as a variable of class data type

Ex: ‘Arun’ is an Object of Trainee Class Syntax for creating objects Object1,

Object2,…

Ex: Trainee oT1,

Syntax for Invoking Methods Object1

Method1()

Object1

Method2()

Ex: oT1

TakeTest()

GetResults()

Copyright © 2006,

Infosys Technologies Ltd

ER/CORP/CRS/LA38/003 Version no: 1

Class and Objects – Example class Trainee { private: int m_iEmpId

public: void SetData(int iEmpId,

} void CalculateSal() { ………

} void CalculateTax() { …………} }

//class Trainee ends here Copyright © 2006,

Infosys Technologies Ltd

int main(int argc,char** argv) { /* Object Creation */ Trainee oT1

SetData(101,”Henry”,1200,150) /* Invoking CalculateSal */ oT1

CalculateSal()

/* Invoking CalculateTax */ oT1

CalculateTax()

ER/CORP/CRS/LA38/003 Version no: 1

Class Access Specifiers – Example class Trainee { int m_iEmpId

public: void SetData(int iEmpId,

char acEmpName[],float fBasic,

} void CalculateSal() { ………

} void CalculateTax() { ………… } }

Copyright © 2006,

Infosys Technologies Ltd

int main(int argc,char** argv) { /* Object Creation */ Trainee oT1

/* Invalid – Accessing private members outside the class */ oT1

SetData(101,”Dave”,1200,350) oT1

CalculateSal()

CalculateTax()

ER/CORP/CRS/LA38/003 Version no: 1

Memory allocation for Classes and Objects class Trainee { private: int m_iEmpId

public: void SetData(int iEmpId,

float fHRA){ } void CalculateSal() { // code goes here } void CalculateTax() { //code goes here } }

Trainee oT1,oT2

Class (Common to all objects)

Code for SetData() Code for CalculateSal() Code for CalcuateTax()

Information about Data Members

Class (Common to all objects)

Code for SetData() Code for CalculateSal() Code for CalcuateTax()

Information about Data Members

Copyright © 2006,

Infosys Technologies Ltd

Object T1 EmpId

Object T2 EmpId

ER/CORP/CRS/LA38/003 Version no: 1

Class – Defining methods outside the class /* Class Declaration */ class Trainee { private: int m_iEmpId

public: void SetData(int iEmpId,

fBasic,fHra){ … …

SetData(43003,”Dave”,1200,350)

Copyright © 2006,

Infosys Technologies Ltd

ER/CORP/CRS/LA38/003 Version no: 1

Class – Coding Standards,

Best Practices & Guidelines • •

One class per file Declare the class in ‘

h’ header file using below format to avoid multiple inclusion of class declarations #ifndef _CLASSNAME_H #define _CLASSNAME_H //Class declaration #endif

Define all the methods in ‘

cpp’ file after including header file Provide Class Header (Refer Structure Header C-Programming/PF) Use File Header and Footer (Refer C-Programming/PF) Provide Function/Method Header Block (Refer C-Programming/ PF)

Copyright © 2006,

Infosys Technologies Ltd

ER/CORP/CRS/LA38/003 Version no: 1

Class – Coding Standards,

Best Practices and Guidelines •

Coding Standards – Member variables

– Methods – Hungarian Notation • SetEmployeeNumber(),

CalculateSalary(),

CalculateTax()

– Object – o • oTrainee1,oTrainee2

Employee

Employee

Employee_main

Copyright © 2006,

Infosys Technologies Ltd

ER/CORP/CRS/LA38/003 Version no: 1

Constructors • • •

Used for automatic initialization of instance variables during Object creation

Has the same name of the class and do not have return types (not even void) Invoked automatically when an object of its associated class is created

public: /* Declaration of Constructor */ Trainee()

/* Declaration of other methods */ void CalculateSal()

} /* Definition of other methods */ void Trainee::CalculateSal() { ……… /* Code to calculate salary */ } void Trainee::CalculateTax() { ……… /* Code to calculate Tax */ }

Copyright © 2006,

Infosys Technologies Ltd

ER/CORP/CRS/LA38/003 Version no: 1

Constructors – Types •

Default Constructor – Takes no parameters and no return value (NOT even void) – Automatically written by C++ if no user-defined constructor is present – The programmer can redefine the default constructor

Parameterized Constructor – Takes one or more parameters – These arguments can be used for initializing the objects when created

Copy Constructor – Takes only one argument which is of same class type – Generally used to copy some selective data members of one object to another – Automatically written by the compiler if no user defined copy constructor is present

– default copy constructor takes exact copy of one object to another

Copyright © 2006,

Infosys Technologies Ltd

ER/CORP/CRS/LA38/003 Version no: 1

Constructors – Example /* Class Declaration */ class Trainee { private: int m_iEmpId

Trainee(int Id,

Trainee(Trainee& RefTrainee)

Trainee oT1

Trainee oT2(43003,”David John”)

Trainee oT3=oT1

} /* Parameterized Constructor */ Trainee::Trainee(int Id,

char Name[25]){ m_pcName=malloc(strlen(Name)+1)

} /* Copy Constructor */ Trainee::Trainee(Trainee& rt) { int len=strlen(rt

Copyright © 2006,

Infosys Technologies Ltd

ER/CORP/CRS/LA38/003 Version no: 1

Constructors – More about Copy Constructors •

A copy constructor is one which takes only one argument of the same class type

/* Copy Constructor */ Trainee::Trainee(Trainee & rt) { int len=strlen(rt

Here rt is a reference object

Generally,

the copy constructor is used when you want to copy a part of data members of one object to a new object

Trainee oT1,

// takes exact copy // or bit-by-bit copy

The copy constructor is called in 4 different situations: • • • • •

Trainee oT1(oT2)

// Copy constructor is called Trainee oT3 = oT2

// Copy constructor is called oT3 = oT2

// Here a bit by bit copy operation takes place void Display(oT1,

// When the object is passed as parameter

And oT2 = Compare(oT3,

// When the object is returned to calling point

Copyright © 2006,

Infosys Technologies Ltd

ER/CORP/CRS/LA38/003 Version no: 1

Destructor •

is a method which automatically gets invoked when an object is destroyed

has the same name as the class and preceded by a tilde(~)

takes no arguments & No return value

a class can have only one destructor

used for housekeeping jobs like releasing memory,

Trainee (int Id,

Trainee::Trainee(int Id,char Name[]) { m_pcName=malloc(strlen(Name)+1)

………/ * Code */ } Trainee::~Trainee() { if(m_pcName

Copyright © 2006,

Infosys Technologies Ltd

ER/CORP/CRS/LA38/003 Version no: 1

Summary • • • • • • • • • •

Programming Techniques Introduction to Object Oriented Concepts Basics of C++ Reference Variables Parameter Passing techniques Abstract Data types Classes and Objects Access Specifiers Class – Best Practices and Guidelines Constructors and Destructors

Copyright © 2006,

Infosys Technologies Ltd

ER/CORP/CRS/LA38/003 Version no: 1

Thank You

Infosys Technologies Ltd

ER/CORP/CRS/LA38/003 Version no: 1