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 is the difference between #import and #include?
Are there any special rules about inlining?
What are the 2 main types of data structures?
How can an improvement in the quality of software be done by try/catch/throw?
What is the iunknown interface?
What is a c++ class?
What do you mean by Stack unwinding?
To what does “event-driven” refer?
What is c strings syntax?
Which function should be used to free the memory allocated by calloc()?
What is split a string in c++?
What is general format for a prototype?