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 / guest
pass a const reference to Alpha in FillData i.e Ans e)
| Is This Answer Correct ? | 16 Yes | 4 No |
Post New Answer View All Answers
Explain mutable storage class specifier.
What can I safely assume about the initial values of variables which are not explicitly initialized?
What is the use of string in c++?
What are proxy objects in c++?
What is pure virtual function?
What is difference between rand () and srand ()?
What does flush do c++?
What do you understand by zombie objects in c++?
In inline " expression passed as argument are evalauated once " while in macro "in some cases expression passed as argument are evaluated more than once " --> i am not getting it plz help to make me understand....
What are destructors?
How many static variables are created if you put one static member into a template class definition?
Explain how the virtual base class is different from the conventional base classes of the opps.
What is a hashmap c++?
What is new in c++?
Who made c++?