what is virtual constroctor ? give an exam for it?-(parimal
dhimmar)
Answers were Sorted based on User's Feedback
Answer / subhashish sen
Constructor can not be virtual.becoz constuctor is an entity
which initializes the V-table(V-table stores the addresses
of all virtual member functions of a class.)So if we declare
a constructor as virtual then who will inialize V-table for
this constructor??Thats why constructor can never be virual.
Is This Answer Correct ? | 5 Yes | 0 No |
Answer / john
virtual constructor is not possible.
This is because v-table is created only after the
constructor is called.
Is This Answer Correct ? | 4 Yes | 0 No |
What output does this program generate as shown? Why? class A { A() { cout << "A::A()" << endl; } ~A() { cout << "A::~A()" << endl; throw "A::exception"; } }; class B { B() { cout << "B::B()" << endl; throw "B::exception"; } ~B() { cout << "B::~B()"; } }; int main(int, char**) { try { cout << "Entering try...catch block" << endl; A objectA; B objectB; cout << "Exiting try...catch block" << endl; } catch (char* ex) { cout << ex << endl; } return 0; }
1. Write a program that performs the following. The user inputs a number and then enters a series of numbers from 1 to that number. Your program should determine which number (or numbers) is missing or duplicated in the series, if any. For example, if the user entered 5 as the initial number and then entered the following sequences, the results should be as shown. Input Sequence Output ---------------------- --------------- 1 2 3 4 5 Nothing bad However, if 7 were the high number, the user would see the results on the right for the following number entries: Input Sequence Output ---------------------- --------------- 1 3 2 4 5 Missing 6 Missing 7 And if 10 were the high number and the user entered the numbers shown on the left, note the list of missing and duplicate numbers: Input Sequence Output ---------------------- --------------- 1 2 4 7 4 4 5 10 8 2 6 Duplicate 2 ( 2 times) Missing 3 Duplicate 4 ( 3 times ) Missing 9
Write code for the multiplication of COMPLEX numbers?
how to write a program that opens a file and display in reverse order?
How reader and writer problem was implemented and come up with effective solution for reader and writer problem in case we have n readers and 1 writer.
write a program that calculate the volume of cylinder after user enters radius and height and show the algorithm used
1 Answers Jomo Kenyatta University,
Where now stands that small knot of villages known as the Endians, a mighty forest once stood. Indeed, legand has it that you could have stoodon the edge of the wood and seen it stretch out for miles, were it not for the trees getting in the way. In one section of the forest, the trees stood in a row and were of hight from 1 to n, each hight occurring once and once only. A tree was only visible if there were no higher trees before it in the row. For example, if the heights were 324165, the only visible trees would have been those of height 3,4 & 6. Write a Program that takes an array of integers representing the heights of the trees in the row as input and prints the list of the visible trees.
Create a program to read two random data set in two files named data1.txt and data2.txt manifold contains integer numbers, whereas data2.txt file contains the float type numbers. Simpanlahmasing each into 2 pieces of data that is an array of type integer array and an array of type float, then calculate the average numbers in the second array.
write a program that reads a series of strings and prints only those strings begging with letter "b"
using repetition structure. Write a c program that will accept five numbers. The program should count and output the total count of even numbers and total count of add numbers.
Assume in University Every student in university as entity, prepare a class for student that store the roll no, name, dob of student, and make funtion of deletion, manipulation, addition of student record.
what is virtual constroctor ? give an exam for it?-(parimal dhimmar)