Is it possible to ask a user, in a program involving stack operations -push and pop using a template class , to enter the data type he wish to store in the array used in program and then accordingly dynamically creating an object of that type at run time through new operator.......if i wish to avoid using the general way of creating an object by templates ???

plz answer in simple basic language ......m jst a begginner in C++ programming.

i'l be grateful to you,
Thanks....

Is it possible to ask a user, in a program involving stack operations -push and pop using a template class , to enter the data type he wish to store in the array used in program and then accordingly dynamically creating an object of that type at run time through new operator.......if i wish to avoid using the general way of creating an object by templates ???

plz answer in simple basic language ......m jst a begginner in C++ programming.

i'l be grateful to you,
Thanks....

Only way I can think of is reading in the input, testing it with a if and the creating the correct type of template in that if. Dont know if that is what you want to avid

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.