So here\'s the study guide for my C++ class: if any of you can help really quick
ID: 3925046 • Letter: S
Question
So here's the study guide for my C++ class: if any of you can help really quickly, it would definately help me prepare for my test tomorrow! Thanks!
"
These are the concepts that you should be familiar with for Exam #3.
Overloaded operators:
- Basic facts (precedence, associativity,number of operands, etc.)
- Operators that cannot be overloaded
- Operators that should not be overloaded
- Member and non-member overloaded operators
- Function calls that are equivalent
Friend functions:
- Pros and cons of making a function a friend of a class
'this' pointer:
- What it is.
File I/O:
- File I/O classes.
- Modes that files can be opened in.
- File I/O related functions.
Function template:
- What it is.
- How to create one.
- Differences with overloaded function.
"
Explanation / Answer
Overloaded operators means single operator can be used to perform different operations. For example, '+' can be operated to perform addition of various data types and can also be used to perform concatenation of strings.
Encapsulation and data hiding is that the non-member functions do not have access to the member functions of a class.If a function is declared as friend function then, that function can access all the private members of that class.For Example, if a friend function func() is declared inside a class then, then that function can access the private members of that class.
'this' pointer is a constant pointer that holds the memory address of the current object.
C++ provides the classes to perform input and output which are: ofstream(stream class which help to write on files), ifstream(stream class which helps to read from files), fstream(stream class which help to read/write both to/from the file)
A template is way to create a class or a function which is not of a particular type.For Example, the following is the syntax for the template class:
template <class-type> class class-name(){ }
The following class can return the arguments of any type. They need not to be of a specific type as int, float etc.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.