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
Can a function take variable length arguments, if yes, how?
What is the use of :: operator in c++?
How important is c++?
Why c++ is so important?
What do you mean by public protected and private in c++?
Is overriding possible in c++?
What does it mean to declare a member variable as static?
What do the header files usually contains?
How can virtual functions in c++ be implemented?
What is object oriented programming (oop)?
What are stacks? Give an example where they are useful.
Difference between a copy constructor and an assignment operator.
What is type of 'this' pointer? Explain when it is get created?
List the features of oops in c++?
How do you invoke a base member function from a derived class in which you have not overridden that function?