0

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....

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by Peppercat101
0

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.