How can we Implement a c++ class such that it allows us to add data members at runtime. This question was asked in an interview.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I find that to be a quite interesting interview question. If I was asking it, I would hope for that to be a starter of a back and forth conversation. The interviewed would have to know that you cannot add members dynamically, but I would hope for questions about the actual problem to solve (what do you want to solve? why do you need to add members?) and proposed solutions that would tackle those situations.
Note that there are two ways of looking to an interview question, looking for facts and looking for problem solving abilities. This is one question where both of them can be exercised (then again, it is up to the interviewer to lead the conversation, i.e. if the person just answers it’s impossible, the interviewer can continue as but I need to be able to…)