Answer the following questions true (T) or false (F)
1. We can assign a base class object to a derived class variable.
2. Virtual functions allow old code to call new code.
1. False
Explanation: Where would the parts of the derived class object that are not in the base class variable go? Once this issue is raised, you should realize this false by now, although this is not formally discussed until the next chapter. The difficulty is called the ‘slicing problem.”.
2. True
Explanation: Suppose the base class (already defined) called Figure. Figure has a draw member function declared with the virtual keyword and a member center. The center function, to do its job, calls erase, then calls draw to center the figure. In this case, a programmer can derive a class Triangle from the already defined (old) code for Figure. The derived class can have a different implementation (new code) of the virtual function draw, which will be called by the center member function. Thus old code calls new code.
You might also like to view...
Point-of-sale terminal and dumb terminal are synonymous
Indicate whether the statement is true or false
?A recent study conducted by the University of Nevada revealed that cyberloafing (wasting time online) costs U.S. businesses more than _____ annually.
A. ?$25 billion B. ?$45 billion C. ?$65 billion D. ?$85 billion
A new mobile banking application is being developed and uses SSL / TLS certificates but penetration tests show that it is still vulnerable to man-in-the-middle attacks, such as DNS hijacking. Which of the following would mitigate this attack?
A. Certificate revocation B. Key escrow C. Public key infrastructure D. Certificate pinning
This text in Figure 5-28 has a title, “A Great Time for Team Building,” a subtitle, “Considering the advantages and challenges of group work,” and details regarding the date and presenter.
Figure 5-28
a. According to the content analysis mentioned in the exercise, how many groups are there?
b. In the current version of the text layout, is there any visual indication of these groups?
c. Without changing the alignment, font, or font size, is there any way to create these groups visually? If so, what is it?
d. Photocopy Figure-28 and use scissors and tape to rearrange the text to show the groupings.