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 |
Given 1 to n random number, find top 10 maximum numbers and explain the time complexity of the algorithm.
main(){int a=5,b 10,c=2, d;a=b c;d=++a=(--c)*2; printf("%d%d%d%d,a,b,c,d; return o;}
#include<iostream.h> //main() //{ class A { friend class B; public: void read(); }; class B { public : int a,b; }; void A::read() { cout<<"welcome"; } main() { A x; B y; y.read(); } In the above program......, as B is a friend of A B can have access to all members,i cant access y.read . could you please tell me the reason and what would i code to execute this program?
What will be the output- for(i=1;i<=3;i++) { printf("%d",i); continue; i++; }
A Binary no. is given, we hav to find it's decimal equivalent.
how to find out the maximum number out of the three inputs.
6 Answers ABC, Apple, C3I, HP, TCS,
Write a program using two-dimensional arrays that determines the highest and lowest of the 12 input values. Example: Enter 12 numbers: 13 15 20 13 35 40 16 18 20 18 20 14 highest: 40 lowest: 13
using friend function find the maximum number from given two numbers from two different classes.write all necessary functions and constructor for the classes.
program to find the magic square using array
Hello, I am trying to write a program in c++ which accepts month and year from the user and prints the calender. So please tell me the algorithm and what is the calender logic.
write a program to sort 'n' elemnts using bubble sort
write a function – oriented program that calculates the sum of the squares from 1 to n. thus, if the input is 3, the output is 14