PGDCA, BCA, B-Tech, MCA, M-Tech, B.Sc computer science राजस्थान सूचना सहायक व कंप्यूटर शिक्षक विशेष नोट्स: इस अध्याय में हम Introduction to C++: Procedural vs Object Oriented Programming (C++ परिचय: प्रक्रियात्मक (C) बनाम ऑब्जेक्ट-ओरिएंटेड (C++) अंतर) की संपूर्ण थ्योरी, मुख्य तकनीकी बिंदु, तुलनात्मक तालिका और विगत परीक्षाओं के पैटर्न पर आधारित 20 अति-महत्वपूर्ण बहुविकल्पीय प्रश्न (MCQs) विस्तृत हिंदी व अंग्रेजी व्याख्या सहित पढ़ेंगे।
Overview: C++ was designed by Bjarne Stroustrup at Bell Labs as a multi-paradigm extension of C supporting Object-Oriented Programming (OOP), generic templates, and high-performance low-level control. Unlike procedural C, which separates functions from global data in a top-down flow, OOP in C++ binds data and methods into secure, reusable objects using a bottom-up architecture.
अध्याय सार: C++ का विकास बेल लैब्स में ब्जार्ने स्ट्रॉस्ट्रप द्वारा C के मल्टी-पैराडाइम विस्तार के रूप में किया गया, जो ऑब्जेक्ट-ओरिएंटेड प्रोग्रामिंग (OOP), टेम्प्लेट्स और उच्च-प्रदर्शन नियंत्रण प्रदान करता है। प्रक्रियात्मक C (जो डेटा और फंक्शन्स को अलग रखकर टॉप-डाउन चलता है) के विपरीत, C++ में OOP डेटा व मेथड्स को बॉटम-अप ढांचे के तहत सुरक्षित ऑब्जेक्ट्स में बांधता है।
Introduction to C++: Procedural vs Object Oriented Programming: Detailed Notes & Architecture (C++ परिचय: प्रक्रियात्मक (C) बनाम ऑब्जेक्ट-ओरिएंटेड (C++) अंतर)
1. Origin of C++ and Multi-Paradigm Evolution (C++ की उत्पत्ति और मल्टी-पैराडाइम विकास)
[EN] Bjarne Stroustrup began developing "C with Classes" at AT&T Bell Labs in 1979 by combining Simula's class abstraction with C's speed, renaming the language C++ in 1983 after the increment operator (++). Standardized first as ISO/IEC 14882 in 1998 (C++98) and updated through C++11, C++14, C++17, C++20, and C++23, C++ supports procedural, object-oriented, generic, and functional programming styles. While largely backward-compatible with C syntax, C++ introduces stricter type checking, references, namespaces, exception handling, and automatic resource management (RAII). Because C++ compiles directly to native machine code without mandatory garbage collection, it powers operating systems, game engines, browsers, and embedded systems.
[HI] ब्जार्ने स्ट्रॉस्ट्रप ने 1979 में बेल लैब्स में Simula की क्लास अवधारणा और C की गति को मिलाकर "C with Classes" शुरू किया, जिसे 1983 में इंक्रीमेंट ऑपरेटर (++) के नाम पर C++ कहा गया। 1998 में ISO/IEC 14882 (C++98) के रूप में मानकीकृत होने के बाद C++11, C++17, C++20 और C++23 जैसे आधुनिक संस्करण आए, जो प्रक्रियात्मक, OOP, जेनेरिक और फंक्शनल शैलियों को सपोर्ट करते हैं। C के साथ उच्च संगतता रखते हुए भी C++ में सख्त टाइप चेकिंग, रेफरेंस, नेमस्पेस, एक्सेप्शन हैंडलिंग और RAII जैसी उन्नत सुविधाएं शामिल हैं। बिना अनिवार्य गार्बेज कलेक्शन के सीधे मशीन कोड में कंपाइल होने के कारण यह ऑपरेटिंग सिस्टम, गेम इंजन और ब्राउज़र बनाने में प्रयुक्त होता है।
2. Procedural Programming Paradigm (C Approach) (प्रक्रियात्मक प्रोग्रामिंग पैराडाइम (C दृष्टिकोण))
[EN] Procedural-Oriented Programming (POP) models a program as a sequence of step-by-step instructions grouped into functions (procedures), following a top-down design methodology. In C, data structures like struct remain passive data containers exposed openly, while separate functions accept pointers to those structs or share global variables. Because global state is accessible by any function in the module, accidental corruption of shared data is hard to track as codebases grow beyond thousands of lines. Furthermore, C lacks built-in function overloading, operator overloading, inheritance, and runtime polymorphism, forcing programmers to use distinct function names or function-pointer tables manually.
[HI] प्रक्रियात्मक प्रोग्रामिंग (POP) एक प्रोग्राम को फंक्शन्स (प्रोसीजर्स) में विभाजित निर्देशों के अनुक्रम के रूप में देखती है और टॉप-डाउन डिज़ाइन पद्धति अपनाती है। C में डेटा (struct) और उस पर काम करने वाले फंक्शन्स अलग-अलग होते हैं तथा साझा डेटा अक्सर ग्लोबल वेरिएबल्स के रूप में खुला रहता है। चूंकि ग्लोबल डेटा किसी भी फंक्शन द्वारा बदला जा सकता है, बड़े प्रोजेक्ट्स में डेटा सुरक्षा और बग-ट्रैकिंग कठिन हो जाती है। इसके अतिरिक्त C में फंक्शन ओवरलोडिंग, ऑपरेटर ओवरलोडिंग, इनहेरिटेंस और ऑटोमैटिक पॉलीमॉर्फिज्म जैसी सुविधाएं अंतर्निहित नहीं होतीं।
3. Object-Oriented Programming Paradigm (C++ Approach) (ऑब्जेक्ट-ओरिएंटेड प्रोग्रामिंग पैराडाइम (C++ दृष्टिकोण))
[EN] Object-Oriented Programming (OOP) shifts focus from algorithms first to real-world entities called objects, following a bottom-up design where independent components assemble into full applications. A class binds state (data members) and behavior (member functions) into a cohesive capsule and guards internal state using private, protected, and public access specifiers. C++ builds upon four foundational OOP pillars: Encapsulation (bundling & protecting data), Abstraction (exposing essential interfaces), Inheritance (reusing and extending classes), and Polymorphism (same interface taking multiple forms via overloading or virtual functions). Objects interact by sending messages (invoking public methods) rather than manipulating each other's internal memory directly.
[HI] ऑब्जेक्ट-ओरिएंटेड प्रोग्रामिंग (OOP) बॉटम-अप दृष्टिकोण अपनाती है, जहाँ वास्तविक दुनिया की इकाइयों को ऑब्जेक्ट्स के रूप में मॉडल करके उनसे बड़ा सिस्टम तैयार किया जाता है। क्लास डेटा मेंबर्स (स्टेट) और मेंबर फंक्शन्स (व्यवहार) को एक साथ बांधती है तथा private, protected व public द्वारा आंतरिक डेटा को सुरक्षित करती है। C++ के चार प्रमुख OOP स्तंभ हैं: एनकैप्सुलेशन, एब्स्ट्रैक्शन, इनहेरिटेंस और पॉलीमॉर्फिज्म (फंक्शन/ऑपरेटर ओवरलोडिंग तथा वर्चुअल फंक्शन्स)। ऑब्जेक्ट्स एक-दूसरे के आंतरिक डेटा को सीधे छूने के बजाय पब्लिक मेथड्स (मैसेज पासिंग) के माध्यम से संवाद करते हैं।
4. Concrete Technical Differences: C vs C++ (C बनाम C++: प्रमुख तकनीकी अंतर)
[EN] At the language level, C++ introduces references (int& r = x;) alongside pointers, new/delete operators that invoke constructors and destructors (unlike malloc/free which allocate raw bytes), and exception handling (try/catch/throw). C++ forbids implicit conversion from void* to typed pointers (requiring an explicit cast), enforces strict function prototypes, and allows defining functions inside structs/classes. Because C++ supports function overloading, the compiler performs name mangling (encoding parameter types into linker symbols), requiring extern "C" when linking C libraries into C++ code. Despite these OOP features, zero-overhead abstraction allows C++ objects without virtual functions to match C struct performance.
[HI] भाषा स्तर पर C++ में पॉइंटर्स के साथ रेफरेंस (int& r = x;), कंस्ट्रक्टर/डिस्ट्रक्टर चलाने वाले new/delete ऑपरेटर्स (malloc/free के विपरीत) और try/catch एक्सेप्शन हैंडलिंग मिलती है। C++ में void* से किसी अन्य पॉइंटर टाइप में अपने आप (इम्प्लिसिट) रूपांतरण की अनुमति नहीं होती और struct के अंदर भी फंक्शन परिभाषित किए जा सकते हैं। फंक्शन ओवरलोडिंग को सपोर्ट करने के लिए C++ कंपाइलर नेम मैंगलिंग (Name Mangling) करता है, इसलिए C लाइब्रेरी को जोड़ने के लिए extern "C" आवश्यक होता है। जीरो-ओवरहेड एब्स्ट्रैक्शन के कारण बिना वर्चुअल फंक्शन वाली C++ क्लासेस की गति C के समान ही रहती है।
Syntax, Formula & Technical Example (Introduction to C++: Procedural vs Object Oriented Programming)
#include <iostream>
class Account {
double balance; // private by default in class
public:
Account(double b) : balance(b) {}
void deposit(double amt) { if (amt > 0) balance += amt; }
double getBalance() const { return balance; }
};
int main() {
Account acc(500.0);
acc.deposit(250.0);
std::cout << acc.getBalance() << '\n';
}
Introduction to C++: Procedural vs Object Oriented Programming Quick Reference & Comparison Table
| Feature | Procedural Programming (C) | Object-Oriented C++ |
|---|---|---|
| Design Approach | Top-down decomposition into functions | Bottom-up assembly of classes & objects |
| Data Security | Global/struct data lacks access specifiers | private/protected enforce data hiding |
| Memory Operators | malloc() / free() allocate raw bytes | new / delete invoke constructors & destructors |
| Overloading & Reuse | No overloading; limited code reuse | Function/operator overloading & inheritance |
Introduction to C++: Procedural vs Object Oriented Programming Top 20 Bilingual MCQs with Answers
Q1. Who developed the C++ programming language at AT&T Bell Laboratories?
(AT&T बेल लेबोरेटरीज में C++ प्रोग्रामिंग भाषा का विकास किसने किया था?)
(A) James Gosling
(B) Ken Thompson
(C) Dennis Ritchie
(D) Bjarne Stroustrup
Correct Answer: (D)
[EN] Bjarne Stroustrup created C++ starting in 1979 as 'C with Classes', whereas Dennis Ritchie created C.
[HI] ब्जार्ने स्ट्रॉस्ट्रप ने 1979 में 'C with Classes' के रूप में C++ का विकास किया, जबकि डेनिस रिची ने C बनाई थी।
Q2. Which design methodology does Object-Oriented Programming (OOP) follow compared to Procedural Programming?
(प्रक्रियात्मक प्रोग्रामिंग की तुलना में ऑब्जेक्ट-ओरिएंटेड प्रोग्रामिंग (OOP) किस डिज़ाइन पद्धति का अनुसरण करती है?)
(A) Linear spaghetti approach
(B) Top-down approach
(C) Bottom-up approach
(D) Hardware-only approach
Correct Answer: (C)
[EN] OOP uses a bottom-up approach (building objects/classes first and integrating them), whereas procedural C uses top-down decomposition.
[HI] OOP बॉटम-अप दृष्टिकोण (पहले ऑब्जेक्ट्स बनाकर प्रणाली जोड़ना) अपनाती है, जबकि प्रक्रियात्मक C टॉप-डाउन दृष्टिकोण का पालन करती है।
Q3. What was the original name of C++ when Bjarne Stroustrup started creating it in 1979?
(1979 में जब ब्जार्ने स्ट्रॉस्ट्रप ने इसे बनाना शुरू किया, तब C++ का प्रारंभिक नाम क्या था?)
(A) C with Classes
(B) Object-C
(C) Turbo C++
(D) Simula-C
Correct Answer: (A)
[EN] The language began as 'C with Classes' in 1979 and was renamed C++ in 1983.
[HI] 1979 में इसकी शुरुआत 'C with Classes' के नाम से हुई थी और 1983 में इसका नाम C++ रखा गया।
Q4. Which of the following are the four fundamental pillars of Object-Oriented Programming?
(निम्नलिखित में से कौन-से ऑब्जेक्ट-ओरिएंटेड प्रोग्रामिंग के चार मूलभूत स्तंभ हैं?)
(A) Compilation, Linking, Loading, Execution
(B) Recursion, Pointers, Macros, Unions
(C) Arrays, Structs, Loops, Functions
(D) Encapsulation, Abstraction, Inheritance, Polymorphism
Correct Answer: (D)
[EN] The four OOP pillars are Encapsulation, Abstraction, Inheritance, and Polymorphism.
[HI] OOP के चार मुख्य स्तंभ एनकैप्सुलेशन, एब्स्ट्रैक्शन, इनहेरिटेंस और पॉलीमॉर्फिज्म हैं।
Q5. How does C++'s new operator fundamentally differ from C's malloc() function?
(C++ का new ऑपरेटर C के malloc() फंक्शन से मूल रूप से किस प्रकार भिन्न है?)
(A) new is a type-safe operator that automatically invokes the constructor
(B) new does not allocate memory on the heap
(C) new returns void* and requires sizeof()
(D) new can only allocate primitive int types
Correct Answer: (A)
[EN] new returns the exact typed pointer without casting, calculates size automatically, and runs the constructor; malloc() allocates uninitialized bytes.
[HI] new बिना टाइपकास्ट के सही पॉइंटर लौटाता है, आकार स्वयं गिनता है और कंस्ट्रक्टर चलाता है; जबकि malloc() बिना इनिशियलाइज़ किए रॉ बाइट्स देता है।
Q6. What enables C++ to support multiple functions having the exact same name with different parameter lists?
(C++ में एक ही नाम के अलग-अलग पैरामीटर वाले कई फंक्शन्स को सपोर्ट करने के लिए कंपाइलर किस तकनीक का उपयोग करता है?)
(A) Dynamic linking only
(B) Garbage collection
(C) Preprocessor macros
(D) Name mangling (function overloading)
Correct Answer: (D)
[EN] Function overloading in C++ relies on the compiler encoding parameter types into symbol names (name mangling).
[HI] फंक्शन ओवरलोडिंग को सपोर्ट करने के लिए C++ कंपाइलर फंक्शन नाम में पैरामीटर टाइप्स जोड़ देता है जिसे नेम मैंगलिंग कहते हैं।
Q7. Which keyword must be used in C++ when declaring a C library function so the linker does not apply C++ name mangling?
(C++ में किसी C लाइब्रेरी फंक्शन को लिंक करते समय नेम मैंगलिंग रोकने के लिए किस कीवर्ड का उपयोग किया जाता है?)
(A) friend class
(B) static inline
(C) extern "C"
(D) namespace std
Correct Answer: (C)
[EN] extern "C" instructs the C++ compiler to use C linkage conventions without mangling symbol names.
[HI] extern "C" कंपाइलर को बिना नेम मैंगलिंग के मानक C लिंकेज का उपयोग करने का निर्देश देता है।
Q8. What happens in C++ if you write int *p = malloc(sizeof(int)); without an explicit cast?
(यदि आप C++ में बिना टाइपकास्ट के int *p = malloc(sizeof(int)); लिखते हैं, तो क्या होता है?)
(A) Runs cleanly just like standard C
(B) Compile-time error because C++ disallows implicit void* to int* conversion
(C) Automatically calls constructor of int
(D) Allocates on the stack instead of heap
Correct Answer: (B)
[EN] Unlike C, C++ is stricter with type safety and forbids assigning a void* directly to a typed pointer without static_cast or C-cast.
[HI] C के विपरीत, C++ में सख्त टाइप चेकिंग होती है और void* को बिना एक्सप्लिसिट कास्ट के int* में असाइन करने पर कंपाइल एरर आता है।
Q9. In OOP, how do independent objects primarily interact with one another?
(OOP में अलग-अलग ऑब्जेक्ट्स मुख्यतः एक-दूसरे के साथ कैसे संवाद (interact) करते हैं?)
(A) By modifying each other's private variables directly
(B) Through goto jumps
(C) By sharing global variables only
(D) By invoking public member functions (message passing)
Correct Answer: (D)
[EN] Objects communicate via public methods (message passing) while keeping internal state hidden.
[HI] ऑब्जेक्ट्स आंतरिक डेटा को छिपाते हुए पब्लिक मेथड्स (मैसेज पासिंग) के जरिए एक-दूसरे से संवाद करते हैं।
Q10. In which year was the first ISO C++ international standard (ISO/IEC 14882, known as C++98) ratified?
(पहला अंतरराष्ट्रीय ISO C++ मानक (ISO/IEC 14882 / C++98) किस वर्ष पारित हुआ था?)
(A) 1979
(B) 1983
(C) 1998
(D) 2011
Correct Answer: (C)
[EN] ISO/IEC 14882:1998 (C++98) was the first official ISO standard for C++.
[HI] ISO/IEC 14882:1998 (C++98) C++ भाषा का पहला आधिकारिक ISO मानक था।
Q11. Which statement accurately characterizes C++ as a programming paradigm?
(प्रोग्रामिंग पैराडाइम के संदर्भ में C++ के लिए कौन-सा कथन सटीक है?)
(A) C++ supports only procedural code without templates
(B) C++ is a pure OOP language where even main() must sit inside a class
(C) C++ is a multi-paradigm language supporting procedural, OOP, generic, and functional styles
(D) C++ runs exclusively inside a JVM bytecode interpreter
Correct Answer: (C)
[EN] Unlike Java or Smalltalk, C++ does not force everything inside classes and supports procedural, OOP, generic (templates), and functional programming.
[HI] Java के विपरीत, C++ एक मल्टी-पैराडाइम भाषा है जो प्रक्रियात्मक, OOP, जेनेरिक (टेम्प्लेट्स) और फंक्शनल चारों शैलियों को सपोर्ट करती है।
Q12. Which feature exists in C++ structs that is NOT allowed in standard C structs?
(C++ के struct में ऐसी कौन-सी सुविधा उपलब्ध है जो मानक C के struct में अनुमत नहीं है?)
(A) Declaring integer variables
(B) Defining member functions and access specifiers inside the struct
(C) Containing arrays of characters
(D) Taking the sizeof() the struct
Correct Answer: (B)
[EN] Standard C structs can contain only data members, whereas C++ structs can hold member functions, constructors, destructors, and access specifiers.
[HI] मानक C के struct में केवल डेटा मेंबर्स हो सकते हैं, जबकि C++ के struct में मेथड्स, कंस्ट्रक्टर्स और एक्सेस स्पेसिफायर्स भी हो सकते हैं।
Q13. Why is data more vulnerable to accidental bugs in large procedural C programs than in OOP C++ programs?
(OOP C++ की तुलना में बड़े प्रक्रियात्मक C प्रोग्राम्स में डेटा के अनजाने में खराब होने का खतरा अधिक क्यों रहता है?)
(A) Shared global data is accessible by many functions without access restrictions
(B) C lacks local variables inside functions
(C) C compilers randomly swap variable addresses
(D) C stores integers in floating-point format
Correct Answer: (A)
[EN] Procedural programs often rely on global or openly passed structs that any function can modify without encapsulation.
[HI] प्रक्रियात्मक प्रोग्राम्स में अक्सर ग्लोबल डेटा या खुले स्ट्रक्चर्स प्रयुक्त होते हैं जिन्हें कोई भी फंक्शन बिना रोक-टोक के बदल सकता है।
Q14. What does the '++' in the name C++ signify?
(C++ के नाम में '++' चिन्ह क्या दर्शाता है?)
(A) Double precision floating point only
(B) Two separate compilers running together
(C) The C increment operator, symbolizing an evolutionary enhancement over C
(D) That C++ has two main() functions
Correct Answer: (C)
[EN] Rick Mascitti coined the name C++ in 1983 using C's ++ increment operator to indicate an improved successor to C.
[HI] 1983 में C के इंक्रीमेंट ऑपरेटर (++) से प्रेरित होकर C++ नाम दिया गया, जो C से एक कदम आगे विकसित भाषा का प्रतीक है।
Q15. Which mechanism in C++ provides compile-time generic programming across arbitrary types?
(C++ में कौन-सी सुविधा किसी भी डेटा टाइप के साथ कंपाइल-टाइम जेनेरिक प्रोग्रामिंग प्रदान करती है?)
(A) Unions
(B) goto statements
(C) Bit fields
(D) Templates
Correct Answer: (D)
[EN] Function and class templates allow writing type-independent generic algorithms (such as std::vector<T> and std::sort).
[HI] फंक्शन और क्लास टेम्प्लेट्स बिना डेटा टाइप दोहराए जेनेरिक कोड (जैसे std::vector<T>) लिखने की सुविधा देते हैं।
Q16. Which of the following statements comparing C and C++ is NOT true?
(C और C++ की तुलना के बारे में निम्नलिखित में से कौन-सा कथन सत्य नहीं है?)
(A) C++ provides bool as a native primitive type (whereas C89 lacked it)
(B) C++ requires a mandatory garbage collector at runtime to reclaim class objects
(C) C++ supports inline functions and references natively
(D) C lacks built-in support for operator overloading
Correct Answer: (B)
[EN] C++ does NOT use a mandatory runtime garbage collector; deterministic destructors (RAII) and manual/smart pointers manage memory.
[HI] C++ में रनटाइम पर कोई अनिवार्य गार्बेज कलेक्टर नहीं होता; इसके बजाय डिटरमिनिस्टिक डिस्ट्रक्टर्स (RAII) और स्मार्ट पॉइंटर्स मेमोरी संभालते हैं।
Q17. Within Introduction to C++: Procedural vs Object Oriented Programming, which feature directly maps to: "Top-down decomposition into functions"?
(Introduction to C++: Procedural vs Object Oriented Programming में कौन सा Feature सीधे "Top-down decomposition into functions" से संबंधित है?)
(A) Overloading & Reuse
(B) Data Security
(C) Design Approach
(D) Memory Operators
Correct Answer: (C)
[EN] In Introduction to C++: Procedural vs Object Oriented Programming, 'Design Approach' handles 'Top-down decomposition into functions' (Bottom-up assembly of classes & objects).
[HI] Introduction to C++: Procedural vs Object Oriented Programming में 'Design Approach' का कार्य/विवरण 'Top-down decomposition into functions' (Bottom-up assembly of classes & objects) है।
Q18. Which option accurately describes 'Data Security' in Introduction to C++: Procedural vs Object Oriented Programming?
(Introduction to C++: Procedural vs Object Oriented Programming के संदर्भ में 'Data Security' की सही विशेषता कौन सी है?)
(A) Global/struct data lacks access specifiers
(B) No overloading; limited code reuse
(C) malloc() / free() allocate raw bytes
(D) Top-down decomposition into functions
Correct Answer: (A)
[EN] 'Data Security' provides 'Global/struct data lacks access specifiers' — key point: private/protected enforce data hiding.
[HI] 'Data Security' का मुख्य विवरण 'Global/struct data lacks access specifiers' है (private/protected enforce data hiding)।
Q19. In Introduction to C++: Procedural vs Object Oriented Programming, identify the correct parameter for the specification: "malloc() / free() allocate raw bytes".
(Introduction to C++: Procedural vs Object Oriented Programming में "malloc() / free() allocate raw bytes" विवरण किस विकल्प के लिए सही है?)
(A) Overloading & Reuse
(B) Data Security
(C) Design Approach
(D) Memory Operators
Correct Answer: (D)
[EN] 'Memory Operators' corresponds to 'malloc() / free() allocate raw bytes' (new / delete invoke constructors & destructors).
[HI] 'Memory Operators' का संबंध 'malloc() / free() allocate raw bytes' (new / delete invoke constructors & destructors) से है।
Q20. Considering Introduction to C++: Procedural vs Object Oriented Programming, what key behavior defines 'Overloading & Reuse'?
(Introduction to C++: Procedural vs Object Oriented Programming में 'Overloading & Reuse' की मुख्य भूमिका या मान क्या है?)
(A) malloc() / free() allocate raw bytes
(B) Top-down decomposition into functions
(C) Global/struct data lacks access specifiers
(D) No overloading; limited code reuse
Correct Answer: (D)
[EN] 'Overloading & Reuse' represents 'No overloading; limited code reuse' (Function/operator overloading & inheritance).
[HI] 'Overloading & Reuse' का अर्थ/मान 'No overloading; limited code reuse' है (Function/operator overloading & inheritance)।
Introduction to C++: Procedural vs Object Oriented Programming — Exam FAQs
Q1: Is every valid C program automatically a valid C++ program?
क्या हर वैध C प्रोग्राम अपने आप एक वैध C++ प्रोग्राम होता है?
[EN] Almost, but not 100%: C++ reserves extra keywords (like class, new, template, virtual), forbids implicit void* conversion, and rejects unprototyped function calls.
[HI] लगभग, लेकिन 100% नहीं: C++ में class, new, virtual जैसे अतिरिक्त कीवर्ड्स आरक्षित हैं, void* का इम्प्लिसिट कन्वर्जन वर्जित है और बिना प्रोटोटाइप वाले फंक्शन कॉल्स अमान्य होते हैं।
Q2: Why is C++ considered faster than Java or Python despite supporting OOP?
OOP सपोर्ट करने के बावजूद C++ को Java या Python की तुलना में तेज क्यों माना जाता है?
[EN] C++ compiles directly to native machine code with zero-overhead abstractions, value-type objects on the stack, and no JVM or garbage-collection pause overhead.
[HI] C++ बिना किसी इंटरप्रेटर या गार्बेज-कलेक्शन पॉज़ के सीधे नेटिव मशीन कोड में कंपाइल होता है और स्टैक पर वैल्यू-टाइप ऑब्जेक्ट्स का उपयोग करता है।
Q3: Can you write a purely procedural program in C++ without using any classes?
क्या C++ में बिना किसी क्लास का उपयोग किए शुद्ध प्रक्रियात्मक प्रोग्राम लिखा जा सकता है?
[EN] Yes, because C++ is multi-paradigm, a C++ program can consist solely of free functions and main() without defining custom classes.
[HI] हाँ, क्योंकि C++ एक मल्टी-पैराडाइम भाषा है, इसलिए बिना कोई कस्टम क्लास बनाए केवल सामान्य फंक्शन्स और main() से प्रोग्राम लिखा जा सकता है।
Post a Comment
Post a Comment