Already have an account? Get multiple benefits of using own account!
Login in your account..!
Remember me
Don't have an account? Create your account in less than a minutes,
Forgot password? how can I recover my password now!
Enter right registered email to receive password!
A: Use operator overloading to present a friend left-shift operator, operator<<.
#include class Fred {
public:
friend std::ostream& operator<< (std::ostream& o, const Fred& fred);
... private:
int i_; // only for illustration
};
std::ostream& operator<< (std::ostream& o, const Fred& fred)
{
return o << fred.i_;
}
int main()
Fred f;
std::cout << "My Fred object: " << f << "\n";
...
We employ a non-member function (a friend in this case) as the Fred object is the right-hand operand of the << operator. If the Fred object was imagined to be on the left hand side of the << (i.e., myFred << std::cout instead of std::cout << myFred), we could have utilized a member function named operator<<.
Note down that operator<< returns the stream. It is so the output operations can be cascaded.
d) a "static destructor" is a static member function of the class which accepts one argument - a pointer to the object of that class to be cracked. It is probably utilized along wi
By pressing ‘6’ (i.e. key’6’ one time) on the keypad, the mobile shows ‘m’ on display screen in write text message area .
I am doing project on home stay which includes features like add homestay,search,book,delete homestay,
A: The inline keyword tells the compiler to substitute the code in the function de_nition for each instance of a function call. Though, substitution takes place only at the compile
Program is to create a file student.dat: Program is to create a file student.dat which contains all name, roll_no,marks(5 sub) and percentage class student {
First line starts with T, number of test cases. Each test case T contains a necklace (N).
A: It allows a program to reference an identifier in global scope which has been hidden by another identifier along with the same name in the local scope.
how do you declare an integer variable
main() { int a[5]={1,3,6,7,0}; int *b; b=&a[2]; } The value of b[-1] is
Op e r a t o r P r e c e d e n c e a n d A s s o c i a t i v e l y : T h e op e r a t o r p r e c e d e n c e a n d i
Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!
whatsapp: +91-977-207-8620
Phone: +91-977-207-8620
Email: [email protected]
All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd