class Alpha {
public:
char data[10000];
Alpha();
~Alpha();
};
class Beta {
public:
Beta() { n = 0; }
void FillData(Alpha a);
private:
int n;
};
How do you make the above sample code more efficient?
a) If possible, make the constructor for Beta private to
reduce the overhead of public constructors.
b) Change the return type in FillData to int to negate the
implicit return conversion from "int" to "void".
c) Make the destructor for Alpha virtual.
d) Make the constructor for Alpha virtual.
e) Pass a const reference to Alpha in FillData
Answer Posted / mpoleg
c)
all other options are not valid c++
| Is This Answer Correct ? | 1 Yes | 3 No |
Post New Answer View All Answers
What is this pointer in c++?
write a corrected statement in c++ so that the statement will work properly. x = y = z + 3a;
How can you quickly find the number of elements stored in a dynamic array?
which operator is used for performing an exponential operation a) > b) ^ c) none
What are the advantages of using a pointer?
What is double in c++?
What are the syntactic rules to be avoid ambiguity in multiple inheritance?
Explain how would you handle a situation where you cannot call the destructor of a local explicitly?
What is stack unwinding?
Write a program which uses functions like strcmp(), strcpy()? etc
What is a dll entry point?
What is token c++?
On throwing an exception by the animal constructor in p = new animalq, can memory leak occur?
Does c++ have a hash table?
What do you mean by static variables?