Unit 1 - 2 Lecture Notes Oops C++
Unit 1 - 2 Lecture Notes Oops C++
3
“Object ori
–
C ++ was early called ‘C with classes’.
/* ….*/ are still valid and more suitable for multi line comments.
The statement cout <<”Hello, world” displayed the string with in quotes on the screen. The identifier
iostream.h represents that stream. The insertion operator << also called the ‘put to’ operator directs
cout<<”sum=”<<sum<<” n”;
cout<<”sum=”<<sum<<” n”<<”average=”<<average<<” n”;
–
·
·
·
·
out<<”enter name”;
out<<”enter age”;
out<<” n name:”<<name;
out<<” n age:”<<age;
identifiers and can’t be used as names for the program variables or other user defi
The name can’t start with a digit.
’ n’;
–
<<” ”
out<<” n”;
<<” ”<<
<<” ”<<
<<” ”<<
<<” ”<<
<<” ”<<
<<” ”<<
if… else statement
’*’,
<<” ”<<
‘=’
• Outside the class definition
• Inside the class function
‘ ’
<<” ”<<
<<” ”<<
•S
•
<<“ ”<<
<<” ”<<
<<” ”<<
<<” ”<<
<<” ”
<<” ”
<<” ”<<
<<” ”<<
<<” ”
<<” ”
<<”_”
<<” ”<<
<<” ”<<” ”
”11’ ”
’ ”
<<” ”
<<” ”
<<” ”;
<<” me”
<<” ”<<e
<<” ”
<<” ”<<
<<” ”<<
<<” ”<<
<<” ”
<<” ”
<<” ”
<<” ”
<<” ”
“ ”<<
<<” ”
<<” ”
<<” 1 :add an item’’
<<” ”
<<” ”
<<” ”
<<” ”
<<” ”
<<” ”
<<” ”
<<” “
<<” ”<<
<<” ”
<<” ”<<
<<” ”
<<” ”
<<” ”