⚙️ C++ Beginner

What is C++ and how does it differ from C?

Why Interviewers Ask This

Foundational questions like this help interviewers calibrate the rest of the interview. A confident, accurate answer signals that you have solid C++ basics — a prerequisite for any developer role.

Answer

C++ is a general-purpose, statically typed, compiled programming language created by Bjarne Stroustrup at Bell Labs in 1985 as an extension of the C language. It is often described as "C with classes." While C is a procedural language, C++ adds several powerful paradigms on top of it. Key differences: (1) Object-Oriented Programming (OOP): C++ supports classes, objects, inheritance, polymorphism, and encapsulation — C has no built-in OOP support; (2) Function overloading: C++ allows multiple functions with the same name but different parameter types — not possible in C; (3) References: C++ introduces reference variables (&) in addition to C's pointers; (4) Templates: C++ generic programming with function and class templates — C uses macros or void pointers; (5) STL: C++ ships with the Standard Template Library (containers, algorithms, iterators) — C has a much smaller standard library; (6) Operator overloading: custom behavior for operators like +, <<; (7) Exception handling: try/catch/throw — C uses setjmp/longjmp or error codes; (8) new/delete: type-safe memory allocation vs C's malloc/free; (9) Namespaces: avoid name collisions; (10) inline functions: replace C macros safely. C++ is fully backward-compatible with C — valid C code is (mostly) valid C++.

Common Mistake

Candidates often give textbook answers here. Interviewers are more impressed when you relate the concept to a specific problem you solved in a real C++ project.