If a class contains at least one pure virtual function, it is called as…
2023
If a class contains at least one pure virtual function, it is called as ............. class.
- A.
Compiled
- B.
Abstract
- C.
Interpreted
- D.
Interface
Attempted by 341 students.
Show answer & explanation
Correct answer: B
A pure virtual function is a function declared in a base class that has no implementation and is marked with = 0. When a class contains at least one pure virtual function, it cannot be instantiated and is known as an abstract class. This class is meant to be inherited by derived classes, which must provide implementations for all pure virtual functions. Abstract classes are used to define a common interface for a group of related classes.
हिन्दी उत्तर: एक शुद्ध वर्चुअल फंक्शन एक ऐसा फंक्शन है जो एक बेस क्लास में घोषित होता है और जिसका कोई वास्तविक कार्य नहीं होता है और = 0 के साथ चिह्नित होता है। जब किसी क्लास में कम से कम एक शुद्ध वर्चुअल फंक्शन होता है, तो उसे अमान्य क्लास कहा जाता है। इस क्लास को विरासत में लेने के लिए बनाया गया है, जिसमें सभी शुद्ध वर्चुअल फंक्शनों के लिए वास्तविक कार्य प्रदान करना आवश्यक होता है। अमान्य क्लास का उपयोग एक समूह संबंधित क्लासों के लिए एक सामान्य इंटरफेस परिभाषित करने के लिए किया जाता है।