JOIN us on
WhatsApp Group Join Now
Telegram Join Join Now

हिंदी माध्यम नोट्स

Class 6

Hindi social science science maths English

Class 7

Hindi social science science maths English

Class 8

Hindi social science science maths English

Class 9

Hindi social science science Maths English

Class 10

Hindi Social science science Maths English

Class 11

Hindi sociology physics physical education maths english economics geography History

chemistry business studies biology accountancy political science

Class 12

Hindi physics physical education maths english economics

chemistry business studies biology accountancy Political science History sociology

Home science Geography

English medium Notes

Class 6

Hindi social science science maths English

Class 7

Hindi social science science maths English

Class 8

Hindi social science science maths English

Class 9

Hindi social science science Maths English

Class 10

Hindi Social science science Maths English

Class 11

Hindi physics physical education maths entrepreneurship english economics

chemistry business studies biology accountancy

Class 12

Hindi physics physical education maths entrepreneurship english economics

chemistry business studies biology accountancy

Categories: c++ language in hindi

C++ : CLASS AND OBJECT , what is class and object in c++ language in hindi , class define , body

class define , body , C++ : CLASS AND OBJECT , what is class and object in c++ language in hindi :-
इससे पहले के article मे function ओवरलोडिंग को discuss किया है | अब इस article मे c++ language के सबसे महत्व पूर्ण topic class और object को discuss करेगे जिससे अतः इस article का c++ language मे सबसे ज्यादा उपयोगी है | अब इस article मे class और object के basic को discuss करेगे अतः आ इस article को जरुरी पढना |c++ language मे multiple conceptual language है इसका मतलब है की c++ language मे बहुत सारे additional concept को introduce किया गया है | अतः c++ language मे कई सारे programming language के concept को add किया गया है | सबसे common concept है object को बनाना |
जब किसी language मे  प्रॉब्लम को object बना कर solve किया जाता है इसे object oriented language कहते है | c++ एक object ओरिएंटेड language है |
c++ मे एक बहुत बड़े प्रोग्राम को छोटे छोटे भागो मे डिवाइड किया जाता है | इन छोटे छोटे भागो objects कहते है |
object data या function का collection होता है जिसे main() function मे use किया जाता है |

c++ class
किसी programming language मे object को बनाने से पहले class को define किया जाता है | class object की image होती है जिसमे object को define किया जाता है | जिस प्रकार कोई डिज़ाइनर किसी माकन को बनाने से पहले नक्शा बनता अहि उसी प्रकार object को बनाने से पहले class को design किया जाट है | जिस प्रकार एक design से कई सारे माकन को बनाया जाता है उसी प्रकार एव्क class से multiple object को बनाया सजा सकता है |

Class Define
class को define करने के लिए class keyword को use किया जाता है | class के बाद class का नाम होता है |{} मे class की body होती है | इसका syntax निन्म होता है :-
class class_name
{
class body ;
}
इस syntax मे निन्म है :
class: ये class को define करने के लिए class keyword है |
class_body : ये class की body मे जिसमे class को define किया जाता है |
class_name : ये class का नाम है जिसका इस्तेमाल class को use करने के लिए किया जाता है |

class body :
class की body मे function / data को define किया जाता है | इन function / data का access mode होता है | यहा तीन mode common है :
1.private : private keyword का use किसी function / data को private बनाने के लिए किया जाता है | private function / data को only class मे ही access किया जाता है |
Public: Public keyword का use किसी function / data को  public बनाने के लिए किया जाता है | public function / data को only class के बहार access किया जाता है |

class का उदहारण निन्म है :
class test
{
private int a,b;
public :
void input()
{
a=12;
}
int input2()
{
b=23;
return b;
}
};

इस उदहारण मे class test को define किया गया है | जिसमे दो data variable a,b को define किया गया है | जिसमे access type private है in data variable को class test मे use किया जाता है | इसमें input () और input2() function को declare किया गया है | in function का access type public है | इन functions को class के बहार use किया जाता है | इस function को main() function या दुसरे function ()मे भी use किया जा सकता है |

C++ Object
जब किसी class को define किया जाता है उसके बाद object को भी declare किया जाता है | इस object के लिए कोई भी memory और storage allocate नहीं होता है | इस class के function / data को use करने के लिए object को declare किया जाता है |
object को declare करने के लिए निन्म syntax को use किया जाता है :-
class_name object_name ;
इसमें object_name से ओबेजेक्ट को use किया जाता है | इसका उदहारण निन्म है :
class test
{
private int a,b;
public :
void input()
{
a=12;
}
int input2()
{
b=23;
return b;
}
};
void main()
{
test t;
}
इस उदहारण मे test type एक object t को declare किया गया है | इस class मे define function को use करने के लिए निन्म method को use करते है :-
क्लास के data memeber और function member को access करने के लिए डॉट operator को use किया जाता है | उदहारण के लिए
t.input() ;
t.input2 ();
इन statement से class test के दोनों functions को use किया जाता है |
इसका उदहारण निन्म है :
#include<iostream.h>
#include<conio.h>
using namespace std;
class test
{
private int a,b;
public :
void input(int e)
{
a=e;
cout<<“Value of a :”<<a;
}
int input2()
{
cout<<“Enter data : “<<endl;
cin>>b;
return b;
}
};
void main()
{
test t;
int object ;
t.input(23);
object = t.input();
cout<<“you enter object value :”<<object<<endl;
}

इस उदहारण मे उपर दिए class और object को discuss किया गया है इसका आउटपुट होगा :
Value of a : 23
Enter data : 12
you enter object value : 12

इस article मे class और object के basic को discuss करेगे | अब आगे के article मे क्लास के उदाहरानो को discuss करेगे जिससे अप सभी के class और object के concept clear हो सके |

Sbistudy

Recent Posts

four potential in hindi 4-potential electrodynamics चतुर्विम विभव किसे कहते हैं

चतुर्विम विभव (Four-Potential) हम जानते हैं कि एक निर्देश तंत्र में विद्युत क्षेत्र इसके सापेक्ष…

2 days ago

Relativistic Electrodynamics in hindi आपेक्षिकीय विद्युतगतिकी नोट्स क्या है परिभाषा

आपेक्षिकीय विद्युतगतिकी नोट्स क्या है परिभाषा Relativistic Electrodynamics in hindi ? अध्याय : आपेक्षिकीय विद्युतगतिकी…

4 days ago

pair production in hindi formula definition युग्म उत्पादन किसे कहते हैं परिभाषा सूत्र क्या है लिखिए

युग्म उत्पादन किसे कहते हैं परिभाषा सूत्र क्या है लिखिए pair production in hindi formula…

7 days ago

THRESHOLD REACTION ENERGY in hindi देहली अभिक्रिया ऊर्जा किसे कहते हैं सूत्र क्या है परिभाषा

देहली अभिक्रिया ऊर्जा किसे कहते हैं सूत्र क्या है परिभाषा THRESHOLD REACTION ENERGY in hindi…

7 days ago

elastic collision of two particles in hindi definition formula दो कणों की अप्रत्यास्थ टक्कर क्या है

दो कणों की अप्रत्यास्थ टक्कर क्या है elastic collision of two particles in hindi definition…

7 days ago
All Rights ReservedView Non-AMP Version
X

Headline

You can control the ways in which we improve and personalize your experience. Please choose whether you wish to allow the following:

Privacy Settings
JOIN us on
WhatsApp Group Join Now
Telegram Join Join Now