Which of the following is NOT a feature of C++ ?

2026

Which of the following is NOT a feature of C++ ?

Answer: D. Automatic Garbage CollectionC++ is an object-oriented language built around three foundational pillars — encapsulation (bundling data with the functions that act on it), inheritance…

  1. A.

    Inheritance

  2. B.

    Polymorphism

  3. C.

    Encapsulation

  4. D.

    Automatic Garbage Collection

Attempted by 2 students.

Show answer & explanation

Correct answer: D

C++ is an object-oriented language built around three foundational pillars — encapsulation (bundling data with the functions that act on it), inheritance (letting one class reuse and extend another class's members), and polymorphism (letting one interface behave differently depending on the underlying object type). Memory in C++, however, is managed by the programmer rather than a language runtime: an object with automatic (stack) storage is constructed and destroyed automatically as its scope is entered and exited, and RAII techniques such as smart pointers use a destructor to release a resource deterministically at that point; an object created with new that is not owned by such a smart pointer must instead be released through an explicit delete written by the programmer, because C++ has no built-in tracing garbage collector that periodically finds and reclaims memory that is no longer referenced.

Checking each option against this picture: a derived class in C++ can inherit members from a base class (inheritance); a base-class pointer or reference can invoke the correct derived-class function at run time through virtual functions, while function and operator overloading give the language a separate, compile-time form of the same idea (polymorphism); and a class can hide its internal data behind public/private/protected access specifiers (encapsulation) — all three are core, directly supported language features. Automatic garbage collection is different in kind: it is a runtime service, present in languages such as Java and C#, that traces and frees unused memory without any deallocation call from the programmer. Standard C++ has no such service built into the language or its runtime.

  • Inheritance — a derived class directly reuses and extends a base class's members; a native C++ language feature.

  • Polymorphism — one interface (a function name or operator) takes different forms: virtual functions give it a run-time form through a base pointer, and function/operator overloading give it a separate compile-time form; C++ supports both natively.

  • Encapsulation — data and the operations on it are bundled into a class with access controlled by public/private/protected specifiers; a native C++ language feature.

  • Automatic Garbage Collection — a language runtime periodically traces and reclaims memory no longer referenced, without any explicit deallocation call; C++ provides no such runtime and instead relies on manual new/delete or RAII-based (destructor-driven) resource management.

Since inheritance, polymorphism, and encapsulation are all directly supported by C++, while automatic memory reclamation is not part of the language, the option that is NOT a feature of C++ is Automatic Garbage Collection.

Explore the full course: Nta Ugc Net Paper 2

Loading lesson…