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 the use of map in c++?
What is the outcome of cout< a) 16 b) 17 c) 16.5
How is computer programming useful in real life?
How many characters are recognized by ANSI C++?
How c functions prevents rework and therefore saves the programers time as wel as length of the code ?
Explain the difference between class and struct in c++?
What are the types of container classes?
Can we make copy constructor private in c++?
What do you mean by a template?
Is c++ still in demand?
What is c++ array?
What is the difference between an enumeration and a set of pre-processor # defines?
You want to link a c++ program to c functions. How would you do it?
Is it possible to have a recursive inline function in c++?
Write a program to encrypt the data in a way that inputs a four digit number and replace each digit by (the sum of that digit plus 7) modulus 10. Then sweep the first digit with the third, second digit with the fourth and print the encrypted number.