• Dheeraj Jha

What is a class? - Part1

Almost every interviewer asks this question. You must have been asked this question in one of your C++ interviews. If you are a beginner or at the beginning of your career, you will definitely be asked this question.

So what am I going to talk about in this blog?

I will be answering these questions.

  • Why interviewer asked you this question?

  • How should you answer this question?

  • How much time should you spend on this?

  • What to answer?

  • What is the benefit of talking so much about this simple question?

  • What will the interviewer think if you give a one-liner answer?

  • What would an interviewer think if you gave a 10-15 minute answer?

Why interviewer asked you this question?

C++ class is a topic on which anyone can talk for as long as they want. Interviewers ask this question because

  • An interview can be started with this simple question.

  • The interviewer wants to give you an opportunity to demonstrate your knowledge of C++ by asking this question.

  • The interviewer will be able to determine the depth of your C++ knowledge by your answer.

How should you answer this question?

Simple, start talking about Class.

How much time should you spend on this?

If someone asks me this question now, I will talk for 10 to 15 minutes before taking a pause or until the interviewer interrupts me. 15 minutes is a good amount of time for a warm-up, and someone can share lots of information in 15 minutes. Depending on the individual, the time may vary.

This is your chance to show off your depth of knowledge to the interviewer. Here's when you can set the interview's theme.


What to answer?

You should

  • Defining class fairly is important.

  • Don't stop once you have given a satisfactory (at least to you) definition.

  • Explain how a class can be used to accomplish oops concepts.

  • One by one, explain all the oops concepts

  • You can go into details as much as you like. As an example, you can also discuss compile-time polymorphism and run-time polymorphism while discussing polymorphism.

  • Make sure you cover most of the basic concepts you are comfortable with within 10-15 minutes.

What is the benefit of talking so much about this simple question?

Yes, you can give a one-liner answer. That will save you 10-15 minutes. What will you do with that?

It is the purpose of the interview to get to know the candidate and his/her knowledge. It is your responsibility to talk and let other people know about your knowledge.

What may the interviewer think if you give a one-liner answer?

  • Does he/she only know this much about class?

  • What to ask the next question?

  • Not sure, if he will be able to answer my next question.

  • Should I ask a tricky question or a basic one?

What would an interviewer think if you gave a 10-15 minute answer?

  • Oh wow, he/she knows a lot.

  • He/she looks confident.

  • It seems that he/she knows the basics well.

  • I don't need to ask basic definition questions.

  • Let's move on to the next level. He/she explained well.

Every interviewer comes with multiple questions and has levels in mind. The interviewer asks questions based on your level. Your chances of being selected increase the more levels you pass.


Why spend time on lower levels?

During my initial career, I used to answer in one line. After several interviews, I found that there are a few sets of questions that are asked in every interview. In order to answer this very first question, I prepared a well-described answer that covered all the basic concepts of C++. In my experience, interviewers rarely ask basic questions after my answer, and usually move on to higher-level questions.

It would be a good idea to take advantage of this opportunity to move up 1-2 levels in interviews.

I will write down how I use to answer this question in What is a class? - Part2.


Subscribe to my newsletter to get a notification of when I will publish my next write-up.

Let me know your views on this topic.

17 views0 comments