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
If dog is a friend of boy, is boy a friend of dog?
Write some differences between an external iterator and an internal iterator? Describe the advantage of an external iterator.
Differences between private, protected and public and give examples.
Is it possible to have a recursive inline function in c++?
What is the use of vtable?
What is function prototyping?
Why iomanip is used in c++?
What is the operator in c++?
How do I download c++?
what is data encapsulation in C++?
How do you write a function that can reverse a linked-list?
Can member data be public?
Explain the concept of dynamic allocation of memory?
Explain what happens when a pointer is deleted twice?
What is the difference between function overloading and operator overloading?