Question
C++ questions classes inh poly etc do all 1. How may a constructor b ovrloadd? Choos all that apply a. Typ of paramtrs b. Ordr
C++ questions classes inh poly etc do all
1. How may a constructor b ovrloadd? Choos all that apply
a. Typ of paramtrs
b. Ordr of paramtr typs
c. Rturn typ
d. By nam
2. Considr th statmnt blow. Which of th Big-Fiv functions will b usd in this cas?
Car mustangCar = gtCarFromFactory(Mustang); // gtCarFromFactory rturns a Car objct
3. xplain your rational for choosing th answr you did for #2 abov
4. Is it possibl to hav mor than on dstructor in a class? Why or why not?
5. If a class objct is dynamically allocatd in mmory, dos its constructor xcut? If so, whn?
6. Mmbrs of a class objct may b accssd through a pointr to th objct by using th _________ oprator.
7. Giv th statmnt to call function lookUpInfo and pass it a vry larg objct of typ objHumongous. Th function mrly looks at th information and rturns a string valu. B fficint, and guard against any changs to th data you pass to th function.
8. Whn a mmbr functions body is writtn insid a class dclaration, th function is ________________.
9. Find all rrors in th following class:
class Circl: {
privat
doubl cntrX;
doubl cntrY;
doubl radius;
public stCntr(doubl, doubl);
stRadius(doubl);
}
10. (7 pts) How can th compilr dtrmin if a constructor is a copy constructor?
11. (3 pts) What is th this pointr?
12. (3pts) A(n) __________ is a spcial constructor, calld whn a nw objct is initializd with anothr objcts data.
13. (9 pts) List th thr cass whr a copy constructor is invokd implicitly.
14. Considr th following dfinition for class Assmbly :
class Assmbly {
public:
int valu;
};
and th variabl ptr_a is dclard and initializd as such:
Assmbly *ptr_a = nw Assmbly;
Us th dot oprator ( . ) to assign 5 to th valu fild of th objct to which ptr_a points.
Us th arrow oprator ( -> ) to assign 23 to th valu fild of th objct to which ptr_a points.
15. Tru or fals: Th compilr will gnrat a dfault dstructor if on if not dfind xplicitly.
16. Assum you hav an lvalu namd nwItm, which is a vry larg objct. Giv th statmnt to assign nwItm to xisting objct of th sam typ calld oldItm, via a mov assignmnt.
17. Giv th rang for loop that invoks th rfill() function for all th GasPump objcts in a collction calld gasStation. Do not us th auto typ spcifir.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started