In c++ there is only virtual destructors, no constructors. Why?

Answer Posted / jos collin

The VTable is created at compile-time itself. But properly
initialized at runtime, including vptr.

Virtual Mechanism is possible only with completely
constructed objects. The constructor is called when the
object is not created completely, it is not allowed.

Is This Answer Correct ?    0 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Which type does string inherit from?

617


What is polymorphism and example?

593


String = "C++ is an object oriented programming language.An imp feature of oops is classes and objects".Write a pgm to count the repeated words from this scenario?

1944


What is the diamond problem in inheritance?

579


just right the logic of it 1--> If few people are electing then every time ur candidate should win 2--> arrange books in box, if box carry weight == books weight then take another box..... find the no of box required.

6487






What is encapsulation oop?

578


any one please tell me the purpose of operator overloading

1967


Objective The objective of this problem is to test the understanding of Object-Oriented Programming (OOP) concepts, in particular, on encapsulation. Problem Description Create a program for managing customer’s bank accounts. A bank customer can do the following operations: 1. Create a new bank account with an initial balance. 2. Deposit money into his/her account. 3. Withdraw money from his/her account. For this operation, you need to output “Transaction successful” if the intended amount of money can be withdrawn, otherwise output “Transaction unsuccessful” and no money will be withdrawn from his/her account. Input The input contains several operations and is terminated by “0”. The operations will be “Create name amount”, “Deposit name amount”, or “Withdraw name amount”, where name is the customer’s name and amount is an integer indicating the amount of money. There will be at most 100 bank accounts and they are all created on the first month when the bank is opening. You may assume that all account holders have unique names and the names consist of only a single word. Output The output contains the transaction result of withdrawal operations and the final balance of all customers after some withdrawal and deposit operations (same order as the input). Sample Input Create Billy 2500 Create Charlie 1000 Create John 100 Withdraw Charlie 500 Deposit John 899 Withdraw Charlie 1000 0

1706


What is pointer in oop?

539


write a program to find 2 power of a 5digit number with out using big int and exponent ?

1897


What is abstraction in oops with example?

776


What is encapsulation in ict?

608


Write a program to sort the number with different sorts in one program ??

1922


How do you define social class?

603


What is destructor give example?

608