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 / mpoleg
c)
all other options are not valid c++
| Is This Answer Correct ? | 1 Yes | 3 No |
Post New Answer View All Answers
What are the advantages of pointers?
What do you mean by function overriding & function overloading in c++?
Am pass the 10000 records to target in target I will take commit interval 15000 when I was stop the work flow what will happened
What is difference between class and function?
What are the 3 levels of programming languages?
Explain some examples of operator overloading?
What does new in c++ do?
What is the type of 'this' pointer? When does it get created?
Write a corrected statement in c++ so that the statement will work properly. if (4 < x < 11) y=2*x;
Which coding certification is best?
What is istream c++?
Comment on local and global scope of a variable.
How to demonstrate the use of a variable?
How do you define/declare constants in c++?
What's the most powerful programming language?