The Big Three consists of which three from this list?

a) Default constructor
b) Copy constructor
c) Constructor with two parameters
d) destructor
e) Operator=


b) Copy constructor , d) destructor , and e) Operator=

The compiler will provide a do-nothing destructor, a copy members copy constructor and a copy members operator = if you don’t supply them. If you have dynamically allocated memory, you need all three. Here’s why. If you need a copy constructor it is because you have pointers to data allocated on the freestore without a copy constructor, just the pointers will be copied. The result of this will be evil. This means you have freestore allocated memory, which you must release, the automatic way to do that is with the destructor. These same reasons compel an overloading of operator=, since you will only get the pointers copied if you don’t provide an operator=.

Computer Science & Information Technology

You might also like to view...

Use the Zoom control to see the entire page.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

When only the two parties involved in sending a message have the code, this is called ________-key encryption

A) private B) foreign C) public D) protocol

Computer Science & Information Technology

Consider the following string matching algorithm, what is the name of this algorithm?

void algo(String P, String T) { int N = T.length()-1; int M = P.length()-1; char p = P.charAt(M); for(int x=N;x>=0;x--){ if(T.charAt(x) == p){ int y=0; for(y=0;y<=M;y++){ if(T.charAt(x-M+y) != P.charAt(y)) break; } if(y ==M+1) System.out.printf("Match at:%d%n",(x-M)); } } } a. Naïve string matching b. Boyer-Moore c. Rabin-Karp d. Aho-Corasick

Computer Science & Information Technology

How could a programmer identify and escape from an infinite loop?

What will be an ideal response?

Computer Science & Information Technology