“I bought this guide a few days ago to prepare for my interview with Oracle. Many of the questions they asked me were from this guide. I found this book absolutely great!”
The question asks “Which operator cannot be *inherited*,
I’ve never heard of operator *inheritance*.
Anyhow these are the operators that can’t be overloaded:
:: . ->* ?: ->
assignment(=) is the only operator in c++
which can we overloaded but not inherited….
reason is if we inherit assignment operator than if with base class refrence we refer derived class than assigment operator should assigned base class to derived class , but if derived class have some new data member than how can these member be assign to base class…
i think constructor
=
I think destructor(~)
new
all the operators in c++ are overloaded but ” = ” cannot be overlaoded
Assignment operator
:: scope resolution operator
assignment operator ” = “cannot be overloaded
The question asks “Which operator cannot be *inherited*,
I’ve never heard of operator *inheritance*.
Anyhow these are the operators that can’t be overloaded:
:: . ->* ?: ->
Well, I just referred to Stroustrup doc and found out this.
:: . ?: sizeof are the operators that cannot be overloaded.
operator sizeof
Correcting my previous comment:
operator= cannot be inherited
“=”Assignment operator can be overloaded(all operators can be overloaded)but cannot be inherited..
“::”Scope resolution operator cannot be inherited.
The ‘=’(equal) operater can be overloaded but cannot be inherited
assignment(=) is the only operator in c++
which can we overloaded but not inherited….
reason is if we inherit assignment operator than if with base class refrence we refer derived class than assigment operator should assigned base class to derived class , but if derived class have some new data member than how can these member be assign to base class…
Leave an Answer/Comment