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
Answers were Sorted based on User's Feedback
Answer / guest
pass a const reference to Alpha in FillData i.e Ans e)
| Is This Answer Correct ? | 16 Yes | 4 No |
What are the methods of exporting a function from a dll?
Write is a binary search tree? Write an algo and tell complexity?
What is c++ w3school?
When the constructor of a base class calls a virtual function, why doesn't the override function of the derived class gets called?
Which programming language is best to learn first?
What is copy constructor? Can we make copy constructor private in c++?
Give 2 examples of a code optimization?
What is the use of 'using' declaration in c++?
What is the most common mistake on c++ and oo projects?
What is cin clear () in c++?
What is code reusability in c++?
implement stack using stack.h headerfile functions
1 Answers Exilant, GMG, Subex, University,