19. Recall that in Lab 5, you implemented the CallDb class which had the followi
ID: 3892935 • Letter: 1
Question
19. Recall that in Lab 5, you implemented the CallDb class which had the following elass definition: const short MAXCALLS15 class Cal1ob lI Line 1 II Line 2 II Line 3 l/ Line 4 I1 Line 5 I/ Line 6 II Line 7 / Line 8 II Line 9 / Line 10 I/ Line 11 Call_callLog[MAXCALLS] unsigned int numCalls; public: Callob) unsigned int Loadcal1D8(istreama) unsigned int GetCountCalloe) bool GetCallinCallB(unsigned int, Call8) int FindByE164Prefixincalioe(unsigned int, const string)i And your constructor was implemented as: Callob::Callob) numCalls-e You want to modify your code so you can specify the size of cal1Log in the constructor, as you did in Lab 7 in a similar manner a. Give the new line that you should use to declare the data member ca11Lo g in the class definition. b. Give the declaration of a new data member that you will need to now have what lines this declaration should be. below and write between c. Give the new line that you should use to declare the constructor in the class definition. d. Give the implementation of your new constructor. This should not be just the method body, but entire method that would go in the cpp file. e. Do you need a copy constructor for this new version of the CallDb elasst Why f. Explain what would happen if you didn't write a destructor Give a declaration of a destructor for the class below, and write down between what lines declaration should be. 8.Explanation / Answer
1. Change _callLog array to a pointer Call *_callLog;
2. Constructor definition:
CallDb(int size){
_callLog = new Call(size);
}
3. No, there is no specific necessity for copy constructor, you can add if you want to copy logs of one object to another
4. If there is no destructor memory will not be released, as now we are using pointers and not arrays.
5. ~CallDb(){
delete _callLog;
}
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.