मेरे पास दो वर्ग हैं,
template<class Type>
class SafePtr {
public:
SafePtr() {}
~SafePtr() {}
void Lock(Type* data, void* key)
{
if (!pKey)
{
pKey = key;
pData = data;
}
}
Type* Unlock(void* key) const
{
if (key ==....
22 जिंदा 2021, 21:40
यह एक शुरुआती सवाल है, लेकिन मैं चारों ओर गुगली कर चुका हूं और इसका जवाब नहीं मिल रहा है।
कहो मेरे पास एक वर्ग व्यक्ति है:
class Person {
private String SSN;
//blah blah blah...
}
और फिर मैं एक उपवर्ग OldMan बनाएँ:
class OldMan inherits Person {
//codey stuff here...
public void setSSN(Stri....
26 नवम्बर 2015, 08:19
मुझे एक प्रकार A चाहिए जो अपने छिपे हुए डेटा को T प्रकार की किसी वस्तु को देगा लेकिन डेटा को अन्य सभी से छुपाएगा। मेरा सी ++ कंपाइलर जीसीसी 4.4 होता है, लेकिन इससे कोई फर्क नहीं पड़ता। यह काम क्यों नहीं करेगा?
#include <iostream>
template <class T> class A {
private:
int n1;
public:
f....
18 मार्च 2012, 01:52
स्पष्ट रूप से यह की-ओरिएंटेड एक्सेस-प्रोटेक्शन पैटर्न:
class SomeKey {
friend class Foo;
SomeKey() {}
// possibly non-copyable too
};
class Bar {
public:
void protectedMethod(SomeKey); // only friends of SomeKey have access
};
... का अभी तक कोई ज्ञात नाम नहीं है, इसलिए मैं इसके ल....
24 जुलाई 2010, 11:33