what is virtual constroctor ? give an exam for it?-(parimal
dhimmar)

Answers were Sorted based on User's Feedback



what is virtual constroctor ? give an exam for it?-(parimal dhimmar)..

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

what is virtual constroctor ? give an exam for it?-(parimal dhimmar)..

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

Post New Answer

More C++ Code Interview Questions

write a function that allocates memory for a single data type passed as a parameter.the function uses the new operator and return a pointer to the allocated memory.the function must catch and handle any exception during allocation

0 Answers   HCL,


swap prog

3 Answers   TCS,


Teta-Omeg-Big-Oh Show that f(n) = n2 + 3n3 is ;(n3).

0 Answers   Qatar University,


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

1 Answers  


Definition of priority queue was given. We have to implement the priority queue using array of pointers with the priorities given in the range 1..n. The array could be accessed using the variable top. The list corresponding to the array elements contains the items having the priority as the array index. Adding an item would require changing the value of top if it has higher priority than top. Extracting an item would require deleting the first element from the corresponding queue. The following class was given: class PriorityQueue { int *Data[100]; int top; public: void put(int item, int priority); // inserts the item with the given priority. int get(int priority); // extract the element with the given priority. int count(); // returns the total elements in the priority queue. int isEmpty(); // check whether the priority queue is empty or not. }; We had to implement all these class functions.

0 Answers   Nagarro, Wollega University,






Display Pattern: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 …

2 Answers   Mind Tree,


what is the best algorithm to sort out unique words from a list of more than 10 million words(1 crore+)? we need the best technique in the terms of execution time.

9 Answers   TCS,


What output does the following code generate? Why? What output does it generate if you make A::Foo() a pure virtual function? class A { A() { this->Foo(); } virtual void Foo() { cout << "A::Foo()" << endl; } }; class B : public A { B() { this->Foo(); } virtual void Foo() { cout << "A::Foo()" << endl; } }; int main(int, char**) { A objectA; B objectB; return 0; }

0 Answers  


write a program to perform generic sort in arrays?

0 Answers  


create a stucture student containing field for roll no,class,year and marks.create 10 student annd store them in a file

0 Answers   HCL,


Write a simple encryption program using string function which apply the substitution method.

0 Answers  


how to take time as input in the format (12:02:13) from user so that controls remains between these columns?

0 Answers  


Categories