Get Off-Campus Placement Jobs Info !!!
Programs asked in Mettl Coding Round
Click To Practce List of Programs asked in Nagarro !!!

Technical Discussion :: C++

3. What is virtual constructors/destructors?

Answer:

Virtual destructors: If an object (with a non-virtual destructor ) is destroyed explicitly by applying the delete operator to a base-class pointer to the object, the base-class destructor function (matching the pointer type) is called on the object.
There is a simple solution to this problem – declare a virtual base-class destructor. This makes all derived-class destructors virtual even though they don’t have the same name as the base-class destructor. Now, if the object in the hierarchy is destroyed explicitly by applying the delete operator to a base-class pointer to a derived-class object, the destructor for the appropriate class is called.

Virtual constructor: Constructors cannot be virtual. Declaring a constructor as a virtual function is a syntax error. Does c++ support multilevel and multiple inheritance?
Yes.
What are the advantages of inheritance?
• It permits code reusability.
• Reusability saves time in program development.
• It encourages the reuse of proven and debugged high-quality software, thus reducing problem after a system becomes functional.
What is the difference between declaration and definition?
The declaration tells the compiler that at some later point we plan to present the definition of this declaration.
E.g.: void stars () //function declaration
The definition contains the actual implementation. E.g.: void stars () // declaration
{
for(int j=10; j>=0; j--) //function body cout<<”*”;
cout< }

Asked In :: Aricent Virtusa

Post Your Answer Here:

Name *
Email
Alert me

Post Your Reply Here:

Report Error

Please Login First Click Here

Chaitenya Malviya4 weeks ago

Dear Raj,

               I am good here, hope you are also doing well. Last month the heritage walk conducted in our city, where i came to know about many incredible buildings and sites, which are not commonly known to all of us.

There i got a chance to meet U.N. secretory general, that was a great experience for me, and knowing of your our city is a great pleasure.

loving you,


|| Reply
vignesh vishwa1 month ago
hi everyone,
Ya..television has impact on children,but in same television help the children to learn good thing and humanity.
Sometimes we have to think out of the box,nowadays there are many programmes which help the children in gaining academic and creative knowledge too, instead of getting used to of watching television we have limit the children a certain time for watching television...by doing this they wont be distracted from thier studies and also they will be updated and satisfied.
|| Reply
R.MohanRaj B.E2 months ago

Dear client,



I am writing this mail to inform you  that  we are celebrating the occasion of Durka
festival from   8th October to 10
October. due to the fact of our cultural festival, Despite that will not able
to send the report during this period.



I apologize for that inconvenience unable to send a report
on time. we assure you that we will send the report on 11th October.



 



I looking forward  to
hearing your response

|| Reply
Deepak Pandey2 months ago

Dear Mr. Gill Roy,

we apologize for the delay in your service. Your payment process which was scheduled for 10th May (Friday) is delayed by 7 days due to 3 days of an unexpected power outage and recovery process. We are trying to process it as fast as possible. we are ensuring you that it will not recur any more. Kindly stay tuned with us.

Thank you,

Regards

Abhimanyu 

Project manager



|| Reply
Deepak Pandey2 months ago

Respected sir,

I am glad to inform you that our institute is going to organize the yearly happening fest 'TECHNICAL SYMPOSIUM' again this year. A lot of new students are going to participate in this fest. It's going to be a large gathering of new technical lovers. We are inviting your students to attend the fest and participate in it to provides new innovative ideas.

thank you 

yours sincerely 

SUNDER 

collage srepresentative 


|| Reply