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
What is a list c++?
What is the purpose of ios::basefield in the following statement?
What is the full form of stl in c++?
How do pointers work?
What is the difference between reference and pointer?
What does it mean to declare a member function as static?
How do you clear a map in c++?
Explain what happens when a pointer is deleted twice?
Which is the best c++ software?
Which software is used to run c++ program?
Discuss the effects occur, after an exception thrown by a member function is unspecified by an exception specification?
Differentiate between the message and method in c++?
What will strcmp("Astring", "Astring"); return a) A positive value b) A negative value c) Zero
Who was the creator of c++?
Write about the retrieval of n number of objects during the process of delete[]p?