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


Please Help Members By Posting Answers For Below Questions

Can we use this pointer in a class specific, operator-overloading function for new operator?

610


How does java differ from c and c++?

535


What new()is different from malloc()?

567


What is the difference between the functions rand(), random(), srand() and randomize()?

727


How can I improve my c++ skills?

552






write a c++ program to create class student having datamember name,Roll_no,age,and branch intilcization all the member using constructor print the all the details on the screen.

2245


What is a stack? How it can be implemented?

692


What is difference between n and endl in c++?

582


What do you mean by ‘void’ return type?

604


What is setf in c++?

572


What is a character in c++?

559


Can constructor be private in c++?

604


Do inline functions improve performance?

641


What is a memory leak c++?

587


What is a hash function c++?

550