Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

What is this pointer in c++?

1375


write a corrected statement in c++ so that the statement will work properly. x = y = z + 3a;

1873


How can you quickly find the number of elements stored in a dynamic array?

1039


which operator is used for performing an exponential operation a) > b) ^ c) none

1039


What are the advantages of using a pointer?

1062


What is double in c++?

1046


What are the syntactic rules to be avoid ambiguity in multiple inheritance?

1168


Explain how would you handle a situation where you cannot call the destructor of a local explicitly?

958


What is stack unwinding?

1119


Write a program which uses functions like strcmp(), strcpy()? etc

1089


What is a dll entry point?

987


What is token c++?

1014


On throwing an exception by the animal constructor in p = new animalq, can memory leak occur?

1120


Does c++ have a hash table?

980


What do you mean by static variables?

1156