SlideShare a Scribd company logo
array1.cpp (4 of 7) 
1 
77 
78 return *this; // enables x = y = 
z, for example 
79 
80 } // end function operator= 
81 
82 // determine if two arrays are 
equal and 
83 // return true, otherwise return 
false 
84 bool Array::operator==( const 
Array &right ) const 
85 { 
86 if ( size != right.size ) 
87 return false; // arrays of
array1.cpp (5 of 7) 
2 
98 // overloaded subscript operator 
for non-const Arrays 
integers1[5] calls 
integers1.operator[]( 5 ) 
99 // reference return creates an 
lvalue 
100 int &Array::operator[]( int 
exit() (header <cstdlib>) ends 
the program. 
subscript ) 
101 { 
102 // check for subscript out of 
range error 
103 if ( subscript < 0 || subscript >= 
size ) { 
104 cout << "nError: Subscript " 
<< subscript
array1.cpp (6 of 7) 
3 
115 // overloaded subscript operator for 
const Arrays 
116 // const reference return creates an 
rvalue 
117 const int &Array::operator[]( int 
subscript ) const 
118 { 
119 // check for subscript out of range 
error 
120 if ( subscript < 0 || subscript >= size ) 
{ 
121 cout << "nError: Subscript " << 
subscript 
122 << " out of range" << endl; 
123 
124 exit( 1 ); // terminate program; 
subscript out of range 
125 
126 } // end if
array1.cpp (7 of 7) 
4 
142 
143 // overloaded output operator for 
class Array 
144 ostream &operator<<( ostream 
&output, const Array &a ) 
145 { 
146 int i; 
147 
148 // output private ptr-based 
array 
149 for ( i = 0; i < a.size; i++ ) { 
150 output << setw( 12 ) << a.ptr[ 
i ]; 
151 
152 if ( ( i + 1 ) % 4 == 0 ) // 4
5 
fig08_06.cpp 
(1 of 3) 
1 // Fig. 8.6: fig08_06.cpp 
2 // Array class test program. 
3 #include <iostream> 
4 
5 using std::cout; 
6 using std::cin; 
7 using std::endl; 
8 
9 #include "array1.h" 
10 
11 int main() 
12 { 
13 Array integers1( 7 ); // seven-element 
Array 
14 Array integers2; // 10-element 
Array by default 
15
6 
fig08_06.cpp 
(2 of 3) 
26 // input and print integers1 and 
integers2 
27 cout << "nInput 17 integers:n"; 
28 cin >> integers1 >> integers2; 
29 
30 cout << "nAfter input, the arrays 
contain:n" 
31 << "integers1:n" << integers1 
32 << "integers2:n" << 
integers2; 
33 
34 // use overloaded inequality (!=) 
operator 
35 cout << "nEvaluating: integers1 
!= integers2n"; 
36 
37 if ( integers1 != integers2 )
7 
fig08_06.cpp 
(3 of 3) 
48 // use overloaded assignment (=) 
operator 
49 cout << "nAssigning integers2 to 
integers1:n"; 
50 integers1 = integers2; // note target is 
smaller 
51 
52 cout << "integers1:n" << integers1 
53 << "integers2:n" << integers2; 
54 
55 // use overloaded equality (==) operator 
56 cout << "nEvaluating: integers1 == 
integers2n"; 
57 
58 if ( integers1 == integers2 ) 
59 cout << "integers1 and integers2 are 
equaln"; 
60 
61 // use overloaded subscript operator to 
create rvalue 
62 cout << "nintegers1[5] is " << integers1[
8 
fig08_06.cpp 
output (1 of 3) 
Size of array integers1 is 7 
Array after initialization: 
0 0 0 0 
0 0 0 
Size of array integers2 is 10 
Array after initialization: 
0 0 0 0 
0 0 0 0 
0 0 
Input 17 integers:
9 
fig08_06.cpp 
output (2 of 3) 
Evaluating: integers1 != integers2 
integers1 and integers2 are not equal 
Size of array integers3 is 7 
Array after initialization: 
1 2 3 4 
5 6 7 
Assigning integers2 to integers1: 
integers1: 
8 9 10 11 
12 13 14 15 
16 17 
integers2:
10 
fig08_06.cpp 
output (3 of 3) 
Assigning 1000 to integers1[5] 
integers1: 
8 9 10 11 
12 1000 14 15 
16 17 
Attempt to assign 1000 to 
integers1[15] 
Error: Subscript 15 out of range
11 
8.9 Converting between Types 
 Casting 
 Traditionally, cast integers to floats, etc. 
 May need to convert between user-defined types 
 Cast operator (conversion operator) 
 Convert from 
 One class to another 
 Class to built-in type (int, char, etc.) 
 Must be non-static member function 
 Cannot be friend 
 Do not specify return type 
 Implicitly returns type to which you are converting
12 
8.9 Converting between Types 
 Example 
 Prototype 
A::operator char *() const; 
 Casts class A to a temporary char * 
•(char *)s calls s.operator char*() 
 Also 
•A::operator int() const; 
•A::operator OtherClass() const;

More Related Content

What's hot

C++ Programming - 4th Study
C++ Programming - 4th StudyC++ Programming - 4th Study
C++ Programming - 4th Study
Chris Ohk
 
Computer Architecture and Organization lab with matlab
Computer Architecture and Organization lab with matlabComputer Architecture and Organization lab with matlab
Computer Architecture and Organization lab with matlab
Shankar Gangaju
 
Command line arguments
Command line argumentsCommand line arguments
Command line arguments
ramyaranjith
 
Tail Recursion in data structure
Tail Recursion in data structureTail Recursion in data structure
Tail Recursion in data structure
Rumman Ansari
 
Mathematics Function in C ,ppt
Mathematics Function in C ,pptMathematics Function in C ,ppt
Mathematics Function in C ,ppt
AllNewTeach
 
C++20 features
C++20 features C++20 features
C++20 features
LogeekNightUkraine
 
Introduction to Computer and Programing - Lecture 04
Introduction to Computer and Programing - Lecture 04Introduction to Computer and Programing - Lecture 04
Introduction to Computer and Programing - Lecture 04hassaanciit
 
Removal Of Recursion
Removal Of RecursionRemoval Of Recursion
Removal Of Recursion
Richa Sharma
 
Variadic functions
Variadic functionsVariadic functions
Variadic functions
ramyaranjith
 
array, function, pointer, pattern matching
array, function, pointer, pattern matchingarray, function, pointer, pattern matching
array, function, pointer, pattern matching
Shakila Mahjabin
 
C Programming Language Part 7
C Programming Language Part 7C Programming Language Part 7
C Programming Language Part 7
Rumman Ansari
 
computer notes - Data Structures - 9
computer notes - Data Structures - 9computer notes - Data Structures - 9
computer notes - Data Structures - 9ecomputernotes
 
How c program execute in c program
How c program execute in c program How c program execute in c program
How c program execute in c program
Rumman Ansari
 
Introduction to ES2015
Introduction to ES2015Introduction to ES2015
Introduction to ES2015
kiranabburi
 
UNIT-II CP DOC.docx
UNIT-II CP DOC.docxUNIT-II CP DOC.docx
UNIT-II CP DOC.docx
JavvajiVenkat
 
Assignement of programming & problem solving(3)a.z
Assignement of programming & problem solving(3)a.zAssignement of programming & problem solving(3)a.z
Assignement of programming & problem solving(3)a.z
Syed Umair
 
JavaScript ES10 and React Js Introduction
JavaScript ES10 and React Js IntroductionJavaScript ES10 and React Js Introduction
JavaScript ES10 and React Js Introduction
Amanpreet Singh
 

What's hot (20)

C++ Programming - 4th Study
C++ Programming - 4th StudyC++ Programming - 4th Study
C++ Programming - 4th Study
 
Computer Architecture and Organization lab with matlab
Computer Architecture and Organization lab with matlabComputer Architecture and Organization lab with matlab
Computer Architecture and Organization lab with matlab
 
Command line arguments
Command line argumentsCommand line arguments
Command line arguments
 
Tail Recursion in data structure
Tail Recursion in data structureTail Recursion in data structure
Tail Recursion in data structure
 
Mathematics Function in C ,ppt
Mathematics Function in C ,pptMathematics Function in C ,ppt
Mathematics Function in C ,ppt
 
C++20 features
C++20 features C++20 features
C++20 features
 
ICP - Lecture 9
ICP - Lecture 9ICP - Lecture 9
ICP - Lecture 9
 
Introduction to Computer and Programing - Lecture 04
Introduction to Computer and Programing - Lecture 04Introduction to Computer and Programing - Lecture 04
Introduction to Computer and Programing - Lecture 04
 
Labsheet_3
Labsheet_3Labsheet_3
Labsheet_3
 
Removal Of Recursion
Removal Of RecursionRemoval Of Recursion
Removal Of Recursion
 
Variadic functions
Variadic functionsVariadic functions
Variadic functions
 
array, function, pointer, pattern matching
array, function, pointer, pattern matchingarray, function, pointer, pattern matching
array, function, pointer, pattern matching
 
C Programming Language Part 7
C Programming Language Part 7C Programming Language Part 7
C Programming Language Part 7
 
computer notes - Data Structures - 9
computer notes - Data Structures - 9computer notes - Data Structures - 9
computer notes - Data Structures - 9
 
How c program execute in c program
How c program execute in c program How c program execute in c program
How c program execute in c program
 
Introduction to ES2015
Introduction to ES2015Introduction to ES2015
Introduction to ES2015
 
UNIT-II CP DOC.docx
UNIT-II CP DOC.docxUNIT-II CP DOC.docx
UNIT-II CP DOC.docx
 
Assignement of programming & problem solving(3)a.z
Assignement of programming & problem solving(3)a.zAssignement of programming & problem solving(3)a.z
Assignement of programming & problem solving(3)a.z
 
C++ control loops
C++ control loopsC++ control loops
C++ control loops
 
JavaScript ES10 and React Js Introduction
JavaScript ES10 and React Js IntroductionJavaScript ES10 and React Js Introduction
JavaScript ES10 and React Js Introduction
 

Viewers also liked

Diapo La Chapelle Largeau
Diapo La Chapelle LargeauDiapo La Chapelle Largeau
Diapo La Chapelle Largeau
psave
 
SynapseIndia mobile apps trends, 2013
SynapseIndia mobile apps  trends, 2013SynapseIndia mobile apps  trends, 2013
SynapseIndia mobile apps trends, 2013
Synapseindiappsdevelopment
 
SynapseIndia java and .net development
SynapseIndia java and .net developmentSynapseIndia java and .net development
SynapseIndia java and .net development
Synapseindiappsdevelopment
 
SynapseIndia mobile apps deployment framework architecture
SynapseIndia mobile apps deployment framework architectureSynapseIndia mobile apps deployment framework architecture
SynapseIndia mobile apps deployment framework architecture
Synapseindiappsdevelopment
 
SynapseIndia drupal presentation on drupal best practices
SynapseIndia drupal  presentation on drupal best practicesSynapseIndia drupal  presentation on drupal best practices
SynapseIndia drupal presentation on drupal best practices
Synapseindiappsdevelopment
 
SynapseIndia dotnet development framework
SynapseIndia  dotnet development frameworkSynapseIndia  dotnet development framework
SynapseIndia dotnet development framework
Synapseindiappsdevelopment
 
Synapseindia android apps overview
Synapseindia android apps overviewSynapseindia android apps overview
Synapseindia android apps overview
Synapseindiappsdevelopment
 
Synapseindia android apps application
Synapseindia android apps applicationSynapseindia android apps application
Synapseindia android apps application
Synapseindiappsdevelopment
 
Synapse india dotnet framework development or c
Synapse india dotnet framework development or cSynapse india dotnet framework development or c
Synapse india dotnet framework development or c
Synapseindiappsdevelopment
 
SynapseIndia dotnet development ajax client library
SynapseIndia dotnet development ajax client librarySynapseIndia dotnet development ajax client library
SynapseIndia dotnet development ajax client library
Synapseindiappsdevelopment
 
SynapseIndia dotnet development methodologies iterative
SynapseIndia dotnet development methodologies   iterativeSynapseIndia dotnet development methodologies   iterative
SynapseIndia dotnet development methodologies iterative
Synapseindiappsdevelopment
 
Synapse india reviews sharing chapter 23 – asp.net
Synapse india reviews sharing  chapter 23 – asp.netSynapse india reviews sharing  chapter 23 – asp.net
Synapse india reviews sharing chapter 23 – asp.net
Synapseindiappsdevelopment
 
Synapseindia strcture of dotnet development part 1
Synapseindia strcture of dotnet development part 1Synapseindia strcture of dotnet development part 1
Synapseindia strcture of dotnet development part 1
Synapseindiappsdevelopment
 
SynapseIndia dotnet development platform overview
SynapseIndia  dotnet development platform overviewSynapseIndia  dotnet development platform overview
SynapseIndia dotnet development platform overview
Synapseindiappsdevelopment
 
SynapseIndia dotnet module development part 1
SynapseIndia  dotnet module development part 1SynapseIndia  dotnet module development part 1
SynapseIndia dotnet module development part 1
Synapseindiappsdevelopment
 
Synapseindia dot net development computer programming
Synapseindia dot net development  computer programmingSynapseindia dot net development  computer programming
Synapseindia dot net development computer programming
Synapseindiappsdevelopment
 
Synapseindia android apps application development
Synapseindia android apps application developmentSynapseindia android apps application development
Synapseindia android apps application development
Synapseindiappsdevelopment
 

Viewers also liked (18)

Diapo La Chapelle Largeau
Diapo La Chapelle LargeauDiapo La Chapelle Largeau
Diapo La Chapelle Largeau
 
SynapseIndia mobile apps trends, 2013
SynapseIndia mobile apps  trends, 2013SynapseIndia mobile apps  trends, 2013
SynapseIndia mobile apps trends, 2013
 
SynapseIndia java and .net development
SynapseIndia java and .net developmentSynapseIndia java and .net development
SynapseIndia java and .net development
 
SynapseIndia mobile apps deployment framework architecture
SynapseIndia mobile apps deployment framework architectureSynapseIndia mobile apps deployment framework architecture
SynapseIndia mobile apps deployment framework architecture
 
SynapseIndia drupal presentation on drupal best practices
SynapseIndia drupal  presentation on drupal best practicesSynapseIndia drupal  presentation on drupal best practices
SynapseIndia drupal presentation on drupal best practices
 
SynapseIndia dotnet development framework
SynapseIndia  dotnet development frameworkSynapseIndia  dotnet development framework
SynapseIndia dotnet development framework
 
Synapseindia android apps overview
Synapseindia android apps overviewSynapseindia android apps overview
Synapseindia android apps overview
 
Synapseindia android apps application
Synapseindia android apps applicationSynapseindia android apps application
Synapseindia android apps application
 
Synapse india dotnet framework development or c
Synapse india dotnet framework development or cSynapse india dotnet framework development or c
Synapse india dotnet framework development or c
 
SynapseIndia dotnet development ajax client library
SynapseIndia dotnet development ajax client librarySynapseIndia dotnet development ajax client library
SynapseIndia dotnet development ajax client library
 
SynapseIndia dotnet development methodologies iterative
SynapseIndia dotnet development methodologies   iterativeSynapseIndia dotnet development methodologies   iterative
SynapseIndia dotnet development methodologies iterative
 
Synapse india reviews sharing chapter 23 – asp.net
Synapse india reviews sharing  chapter 23 – asp.netSynapse india reviews sharing  chapter 23 – asp.net
Synapse india reviews sharing chapter 23 – asp.net
 
Synapseindia strcture of dotnet development part 1
Synapseindia strcture of dotnet development part 1Synapseindia strcture of dotnet development part 1
Synapseindia strcture of dotnet development part 1
 
Chapter 6 arrays part-1
Chapter 6   arrays part-1Chapter 6   arrays part-1
Chapter 6 arrays part-1
 
SynapseIndia dotnet development platform overview
SynapseIndia  dotnet development platform overviewSynapseIndia  dotnet development platform overview
SynapseIndia dotnet development platform overview
 
SynapseIndia dotnet module development part 1
SynapseIndia  dotnet module development part 1SynapseIndia  dotnet module development part 1
SynapseIndia dotnet module development part 1
 
Synapseindia dot net development computer programming
Synapseindia dot net development  computer programmingSynapseindia dot net development  computer programming
Synapseindia dot net development computer programming
 
Synapseindia android apps application development
Synapseindia android apps application developmentSynapseindia android apps application development
Synapseindia android apps application development
 

Similar to Synapse india dotnet development overloading operater part 3

Arrays
ArraysArrays
Arrays
fahadshakeel
 
Arrays and strings in c++
Arrays and strings in c++Arrays and strings in c++
Arrays and strings in c++
GC University Faisalabad
 
Operator overloading
Operator overloadingOperator overloading
Operator overloading
piyush Kumar Sharma
 
Object oriented programming; operator overloading array
Object oriented programming; operator overloading arrayObject oriented programming; operator overloading array
Object oriented programming; operator overloading array
Syed Zaid Irshad
 
Operator Overloading & Type Conversions
Operator Overloading & Type ConversionsOperator Overloading & Type Conversions
Operator Overloading & Type Conversions
Rokonuzzaman Rony
 
CPP Homework Help
CPP Homework HelpCPP Homework Help
CPP Homework Help
C++ Homework Help
 
C Arrays.ppt
C Arrays.pptC Arrays.ppt
C Arrays.ppt
ssuser0c1819
 
C++ Nested loops, matrix and fuctions.pdf
C++ Nested loops, matrix and fuctions.pdfC++ Nested loops, matrix and fuctions.pdf
C++ Nested loops, matrix and fuctions.pdf
yamew16788
 
Array in Java
Array in JavaArray in Java
Array in Java
Shehrevar Davierwala
 
lecture7.ppt
lecture7.pptlecture7.ppt
lecture7.ppt
EdFeranil
 
Unit 3
Unit 3 Unit 3
Unit 3
GOWSIKRAJAP
 
I have written the code but cannot complete the assignment please help.pdf
I have written the code but cannot complete the assignment please help.pdfI have written the code but cannot complete the assignment please help.pdf
I have written the code but cannot complete the assignment please help.pdf
shreeaadithyaacellso
 
lecture12.ppt
lecture12.pptlecture12.ppt
lecture12.ppt
UmairMughal74
 
Operator overloading in c++ is the most required.
Operator overloading in c++ is the most required.Operator overloading in c++ is the most required.
Operator overloading in c++ is the most required.
iammukesh1075
 
Lecture 5Arrays on c++ for Beginner.pptx
Lecture 5Arrays on c++ for Beginner.pptxLecture 5Arrays on c++ for Beginner.pptx
Lecture 5Arrays on c++ for Beginner.pptx
arjurakibulhasanrrr7
 
Cpl
CplCpl
Notes for C++ Programming / Object Oriented C++ Programming for MCA, BCA and ...
Notes for C++ Programming / Object Oriented C++ Programming for MCA, BCA and ...Notes for C++ Programming / Object Oriented C++ Programming for MCA, BCA and ...
Notes for C++ Programming / Object Oriented C++ Programming for MCA, BCA and ...
ssuserd6b1fd
 
Introduction to cpp (c++)
Introduction to cpp (c++)Introduction to cpp (c++)
Introduction to cpp (c++)
Arun Umrao
 
CHAPTER 5
CHAPTER 5CHAPTER 5
CHAPTER 5
mohd_mizan
 

Similar to Synapse india dotnet development overloading operater part 3 (20)

Arrays
ArraysArrays
Arrays
 
Arrays and strings in c++
Arrays and strings in c++Arrays and strings in c++
Arrays and strings in c++
 
Operator overloading
Operator overloadingOperator overloading
Operator overloading
 
Object oriented programming; operator overloading array
Object oriented programming; operator overloading arrayObject oriented programming; operator overloading array
Object oriented programming; operator overloading array
 
Operator Overloading & Type Conversions
Operator Overloading & Type ConversionsOperator Overloading & Type Conversions
Operator Overloading & Type Conversions
 
CPP Homework Help
CPP Homework HelpCPP Homework Help
CPP Homework Help
 
C Arrays.ppt
C Arrays.pptC Arrays.ppt
C Arrays.ppt
 
C++ Nested loops, matrix and fuctions.pdf
C++ Nested loops, matrix and fuctions.pdfC++ Nested loops, matrix and fuctions.pdf
C++ Nested loops, matrix and fuctions.pdf
 
Array in Java
Array in JavaArray in Java
Array in Java
 
lecture7.ppt
lecture7.pptlecture7.ppt
lecture7.ppt
 
Unit 3
Unit 3 Unit 3
Unit 3
 
I have written the code but cannot complete the assignment please help.pdf
I have written the code but cannot complete the assignment please help.pdfI have written the code but cannot complete the assignment please help.pdf
I have written the code but cannot complete the assignment please help.pdf
 
lecture12.ppt
lecture12.pptlecture12.ppt
lecture12.ppt
 
Operator overloading in c++ is the most required.
Operator overloading in c++ is the most required.Operator overloading in c++ is the most required.
Operator overloading in c++ is the most required.
 
Lecture 5Arrays on c++ for Beginner.pptx
Lecture 5Arrays on c++ for Beginner.pptxLecture 5Arrays on c++ for Beginner.pptx
Lecture 5Arrays on c++ for Beginner.pptx
 
Cpl
CplCpl
Cpl
 
Notes for C++ Programming / Object Oriented C++ Programming for MCA, BCA and ...
Notes for C++ Programming / Object Oriented C++ Programming for MCA, BCA and ...Notes for C++ Programming / Object Oriented C++ Programming for MCA, BCA and ...
Notes for C++ Programming / Object Oriented C++ Programming for MCA, BCA and ...
 
Introduction to cpp (c++)
Introduction to cpp (c++)Introduction to cpp (c++)
Introduction to cpp (c++)
 
CHAPTER 5
CHAPTER 5CHAPTER 5
CHAPTER 5
 
White box-sol
White box-solWhite box-sol
White box-sol
 

More from Synapseindiappsdevelopment

Synapse india elance top in demand in it skills
Synapse india elance top in demand in it skillsSynapse india elance top in demand in it skills
Synapse india elance top in demand in it skills
Synapseindiappsdevelopment
 
SynapseIndia dotnet web development architecture module
SynapseIndia dotnet web development architecture moduleSynapseIndia dotnet web development architecture module
SynapseIndia dotnet web development architecture module
Synapseindiappsdevelopment
 
SynapseIndia dotnet framework library
SynapseIndia  dotnet framework librarySynapseIndia  dotnet framework library
SynapseIndia dotnet framework library
Synapseindiappsdevelopment
 
SynapseIndia dotnet web applications development
SynapseIndia  dotnet web applications developmentSynapseIndia  dotnet web applications development
SynapseIndia dotnet web applications development
Synapseindiappsdevelopment
 
SynapseIndia dotnet website security development
SynapseIndia  dotnet website security developmentSynapseIndia  dotnet website security development
SynapseIndia dotnet website security development
Synapseindiappsdevelopment
 
SynapseIndia mobile build apps management
SynapseIndia mobile build apps managementSynapseIndia mobile build apps management
SynapseIndia mobile build apps management
Synapseindiappsdevelopment
 
SynapseIndia mobile apps deployment framework internal architecture
SynapseIndia mobile apps deployment framework internal architectureSynapseIndia mobile apps deployment framework internal architecture
SynapseIndia mobile apps deployment framework internal architecture
Synapseindiappsdevelopment
 
SynapseIndia dotnet development panel control
SynapseIndia dotnet development panel controlSynapseIndia dotnet development panel control
SynapseIndia dotnet development panel control
Synapseindiappsdevelopment
 
SynapseIndia php web development
SynapseIndia php web developmentSynapseIndia php web development
SynapseIndia php web development
Synapseindiappsdevelopment
 
SynapseIndia mobile apps architecture
SynapseIndia mobile apps architectureSynapseIndia mobile apps architecture
SynapseIndia mobile apps architecture
Synapseindiappsdevelopment
 
SynapseIndia mobile apps
SynapseIndia mobile appsSynapseIndia mobile apps
SynapseIndia mobile apps
Synapseindiappsdevelopment
 
SynapseIndia dotnet development
SynapseIndia dotnet developmentSynapseIndia dotnet development
SynapseIndia dotnet development
Synapseindiappsdevelopment
 
SynapseIndia dotnet client library Development
SynapseIndia dotnet client library DevelopmentSynapseIndia dotnet client library Development
SynapseIndia dotnet client library Development
Synapseindiappsdevelopment
 
SynapseIndia creating asp controls programatically development
SynapseIndia creating asp controls programatically developmentSynapseIndia creating asp controls programatically development
SynapseIndia creating asp controls programatically development
Synapseindiappsdevelopment
 
SynapseIndia asp.net2.0 ajax Development
SynapseIndia asp.net2.0 ajax DevelopmentSynapseIndia asp.net2.0 ajax Development
SynapseIndia asp.net2.0 ajax Development
Synapseindiappsdevelopment
 
SynapseIndia drupal presentation on drupal info
SynapseIndia drupal  presentation on drupal infoSynapseIndia drupal  presentation on drupal info
SynapseIndia drupal presentation on drupal info
Synapseindiappsdevelopment
 
SynapseIndia drupal presentation on drupal
SynapseIndia drupal  presentation on drupalSynapseIndia drupal  presentation on drupal
SynapseIndia drupal presentation on drupal
Synapseindiappsdevelopment
 
SynapseIndia dotnet debugging development process
SynapseIndia dotnet debugging development processSynapseIndia dotnet debugging development process
SynapseIndia dotnet debugging development process
Synapseindiappsdevelopment
 
Synapse india sharing info on dotnet framework part1
Synapse india sharing info on dotnet framework part1Synapse india sharing info on dotnet framework part1
Synapse india sharing info on dotnet framework part1
Synapseindiappsdevelopment
 
Synapse india sharing info on dotnet framework part2
Synapse india sharing info on dotnet framework part2Synapse india sharing info on dotnet framework part2
Synapse india sharing info on dotnet framework part2
Synapseindiappsdevelopment
 

More from Synapseindiappsdevelopment (20)

Synapse india elance top in demand in it skills
Synapse india elance top in demand in it skillsSynapse india elance top in demand in it skills
Synapse india elance top in demand in it skills
 
SynapseIndia dotnet web development architecture module
SynapseIndia dotnet web development architecture moduleSynapseIndia dotnet web development architecture module
SynapseIndia dotnet web development architecture module
 
SynapseIndia dotnet framework library
SynapseIndia  dotnet framework librarySynapseIndia  dotnet framework library
SynapseIndia dotnet framework library
 
SynapseIndia dotnet web applications development
SynapseIndia  dotnet web applications developmentSynapseIndia  dotnet web applications development
SynapseIndia dotnet web applications development
 
SynapseIndia dotnet website security development
SynapseIndia  dotnet website security developmentSynapseIndia  dotnet website security development
SynapseIndia dotnet website security development
 
SynapseIndia mobile build apps management
SynapseIndia mobile build apps managementSynapseIndia mobile build apps management
SynapseIndia mobile build apps management
 
SynapseIndia mobile apps deployment framework internal architecture
SynapseIndia mobile apps deployment framework internal architectureSynapseIndia mobile apps deployment framework internal architecture
SynapseIndia mobile apps deployment framework internal architecture
 
SynapseIndia dotnet development panel control
SynapseIndia dotnet development panel controlSynapseIndia dotnet development panel control
SynapseIndia dotnet development panel control
 
SynapseIndia php web development
SynapseIndia php web developmentSynapseIndia php web development
SynapseIndia php web development
 
SynapseIndia mobile apps architecture
SynapseIndia mobile apps architectureSynapseIndia mobile apps architecture
SynapseIndia mobile apps architecture
 
SynapseIndia mobile apps
SynapseIndia mobile appsSynapseIndia mobile apps
SynapseIndia mobile apps
 
SynapseIndia dotnet development
SynapseIndia dotnet developmentSynapseIndia dotnet development
SynapseIndia dotnet development
 
SynapseIndia dotnet client library Development
SynapseIndia dotnet client library DevelopmentSynapseIndia dotnet client library Development
SynapseIndia dotnet client library Development
 
SynapseIndia creating asp controls programatically development
SynapseIndia creating asp controls programatically developmentSynapseIndia creating asp controls programatically development
SynapseIndia creating asp controls programatically development
 
SynapseIndia asp.net2.0 ajax Development
SynapseIndia asp.net2.0 ajax DevelopmentSynapseIndia asp.net2.0 ajax Development
SynapseIndia asp.net2.0 ajax Development
 
SynapseIndia drupal presentation on drupal info
SynapseIndia drupal  presentation on drupal infoSynapseIndia drupal  presentation on drupal info
SynapseIndia drupal presentation on drupal info
 
SynapseIndia drupal presentation on drupal
SynapseIndia drupal  presentation on drupalSynapseIndia drupal  presentation on drupal
SynapseIndia drupal presentation on drupal
 
SynapseIndia dotnet debugging development process
SynapseIndia dotnet debugging development processSynapseIndia dotnet debugging development process
SynapseIndia dotnet debugging development process
 
Synapse india sharing info on dotnet framework part1
Synapse india sharing info on dotnet framework part1Synapse india sharing info on dotnet framework part1
Synapse india sharing info on dotnet framework part1
 
Synapse india sharing info on dotnet framework part2
Synapse india sharing info on dotnet framework part2Synapse india sharing info on dotnet framework part2
Synapse india sharing info on dotnet framework part2
 

Recently uploaded

Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Aggregage
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
SOFTTECHHUB
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
James Anderson
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
Kari Kakkonen
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems S.M.S.A.
 
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptxSecstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
nkrafacyberclub
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
mikeeftimakis1
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
Adtran
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
Quotidiano Piemontese
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Paige Cruz
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
Matthew Sinclair
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
DianaGray10
 

Recently uploaded (20)

Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
 
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptxSecstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
 

Synapse india dotnet development overloading operater part 3

  • 1. array1.cpp (4 of 7) 1 77 78 return *this; // enables x = y = z, for example 79 80 } // end function operator= 81 82 // determine if two arrays are equal and 83 // return true, otherwise return false 84 bool Array::operator==( const Array &right ) const 85 { 86 if ( size != right.size ) 87 return false; // arrays of
  • 2. array1.cpp (5 of 7) 2 98 // overloaded subscript operator for non-const Arrays integers1[5] calls integers1.operator[]( 5 ) 99 // reference return creates an lvalue 100 int &Array::operator[]( int exit() (header <cstdlib>) ends the program. subscript ) 101 { 102 // check for subscript out of range error 103 if ( subscript < 0 || subscript >= size ) { 104 cout << "nError: Subscript " << subscript
  • 3. array1.cpp (6 of 7) 3 115 // overloaded subscript operator for const Arrays 116 // const reference return creates an rvalue 117 const int &Array::operator[]( int subscript ) const 118 { 119 // check for subscript out of range error 120 if ( subscript < 0 || subscript >= size ) { 121 cout << "nError: Subscript " << subscript 122 << " out of range" << endl; 123 124 exit( 1 ); // terminate program; subscript out of range 125 126 } // end if
  • 4. array1.cpp (7 of 7) 4 142 143 // overloaded output operator for class Array 144 ostream &operator<<( ostream &output, const Array &a ) 145 { 146 int i; 147 148 // output private ptr-based array 149 for ( i = 0; i < a.size; i++ ) { 150 output << setw( 12 ) << a.ptr[ i ]; 151 152 if ( ( i + 1 ) % 4 == 0 ) // 4
  • 5. 5 fig08_06.cpp (1 of 3) 1 // Fig. 8.6: fig08_06.cpp 2 // Array class test program. 3 #include <iostream> 4 5 using std::cout; 6 using std::cin; 7 using std::endl; 8 9 #include "array1.h" 10 11 int main() 12 { 13 Array integers1( 7 ); // seven-element Array 14 Array integers2; // 10-element Array by default 15
  • 6. 6 fig08_06.cpp (2 of 3) 26 // input and print integers1 and integers2 27 cout << "nInput 17 integers:n"; 28 cin >> integers1 >> integers2; 29 30 cout << "nAfter input, the arrays contain:n" 31 << "integers1:n" << integers1 32 << "integers2:n" << integers2; 33 34 // use overloaded inequality (!=) operator 35 cout << "nEvaluating: integers1 != integers2n"; 36 37 if ( integers1 != integers2 )
  • 7. 7 fig08_06.cpp (3 of 3) 48 // use overloaded assignment (=) operator 49 cout << "nAssigning integers2 to integers1:n"; 50 integers1 = integers2; // note target is smaller 51 52 cout << "integers1:n" << integers1 53 << "integers2:n" << integers2; 54 55 // use overloaded equality (==) operator 56 cout << "nEvaluating: integers1 == integers2n"; 57 58 if ( integers1 == integers2 ) 59 cout << "integers1 and integers2 are equaln"; 60 61 // use overloaded subscript operator to create rvalue 62 cout << "nintegers1[5] is " << integers1[
  • 8. 8 fig08_06.cpp output (1 of 3) Size of array integers1 is 7 Array after initialization: 0 0 0 0 0 0 0 Size of array integers2 is 10 Array after initialization: 0 0 0 0 0 0 0 0 0 0 Input 17 integers:
  • 9. 9 fig08_06.cpp output (2 of 3) Evaluating: integers1 != integers2 integers1 and integers2 are not equal Size of array integers3 is 7 Array after initialization: 1 2 3 4 5 6 7 Assigning integers2 to integers1: integers1: 8 9 10 11 12 13 14 15 16 17 integers2:
  • 10. 10 fig08_06.cpp output (3 of 3) Assigning 1000 to integers1[5] integers1: 8 9 10 11 12 1000 14 15 16 17 Attempt to assign 1000 to integers1[15] Error: Subscript 15 out of range
  • 11. 11 8.9 Converting between Types  Casting  Traditionally, cast integers to floats, etc.  May need to convert between user-defined types  Cast operator (conversion operator)  Convert from  One class to another  Class to built-in type (int, char, etc.)  Must be non-static member function  Cannot be friend  Do not specify return type  Implicitly returns type to which you are converting
  • 12. 12 8.9 Converting between Types  Example  Prototype A::operator char *() const;  Casts class A to a temporary char * •(char *)s calls s.operator char*()  Also •A::operator int() const; •A::operator OtherClass() const;