-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcpp.json
More file actions
378 lines (378 loc) Β· 54.6 KB
/
Copy pathcpp.json
File metadata and controls
378 lines (378 loc) Β· 54.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
[
{
"id": "1",
"name": "Introduction",
"img": "https://raw.githubusercontent.com/abhivishrut/APIs/main/Images/ConstantImages/introduction.png",
"message": "π΄ C++ programming ek popular programming language hai jo object-oriented programming ke concepts ke through program design karna allow karta hai. C++ programming ko 1985 me Bjarne Stroustrup ne develop kiya tha, jo C programming ki ek upgrade hai.\n\nC++ programming mein hum object-oriented programming ke 4 basic principles ko follow karte hai: encapsulation, inheritance, polymorphism, and abstraction.\n\nπ~1. Encapsulation: Iski madad se hum data aur functions ko ek sath package kar sakte hai aur iska use ek object ke through kar sakte hai.\n\nπ~2. Inheritance: Iski madad se hum ek class ke features ko doosre class me inherit kar sakte hai, jisse code ka reuse ho jaata hai.\n\nπ~3. Polymorphism: Iski madad se hum ek function ko doosre function ke roop me use kar sakte hai.\n\nπ~4. Abstraction: Iski madad se hum data aur functions ko abstract kar sakte hai, jisse code ka complexity kam hota hai.\n\nπ΄ C++ programming mein hum classes, objects, functions, loops, conditionals, pointers, arrays, strings, etc. ka use kar sakte hai. Iske alawa, C++ mein hum exception handling, templates, namespaces, STL (Standard Template Library), etc. ka use bhi kar sakte hai.\n\nπ΄ C++ programming ko maine jo bataaya tha, uske alawa bahut sare features hai jo aap C++ programming ko override karne ke liye use kar sakte hai. C++ programming ko commercial software development, game development, embedded systems, etc. me use kiya jata hai.\n\n",
"example": "0",
"remcont": "0"
},
{
"id": "2",
"name": "Installation",
"img": "https://raw.githubusercontent.com/abhivishrut/APIs/main/Images/ConstantImages/installation.png",
"message": "π΄ C++ ke liye aapko ek compiler ki zarurat hoti hai. Windows par, MinGW (Minimalist GNU for Windows) ek popular option hai. Niche diye gaye steps ko follow karein:\n\nπ~MinGW Download Karein: Sabse pehle, aapko MinGW ki official website par jaana hoga aur wahan se MinGW ka installer download karna hoga.\n\nπ~MinGW Install Karein: Download hone ke baad, installer ko run karein aur instructions follow karte hue MinGW ko install karein. Default settings par hi rehne dein.\n\nπ~Environment Variables Set Karein: MinGW install karne ke baad, aapko apne system ke environment variables me MinGW directory ko add karna hoga. Iske liye, System Properties > Advanced > Environment Variables par jaayein, aur βPathβ variable me MinGW directory ka path add karein.\n\nπ~Verify Karein: Installation verify karne ke liye, Command Prompt open karein aur g++ --version likh kar enter press karein. Agar aapko g++ ka version dikhai de raha hai, toh matlab hai ki MinGW sahi se install ho gaya hai.\n\nπ΄ Ab aap apne system par C++ programs likh sakte hain aur unhe compile kar sakte hain.",
"example": "0",
"remcont": "0"
},
{
"id": "3",
"name": "Syntax",
"img": "https://raw.githubusercontent.com/abhivishrut/APIs/main/Images/ConstantImages/syntax.png",
"message": "π΄ C++ ka syntax bahut simple hai. Niche maine kuch basic syntax elements ko explain kiya hai:\n\nπ~Variables: Variables data store karne ke liye use hote hain. Har variable ka ek type hota hai, jaise int (integer), float (floating point number), char (character), etc. Variable declare karne ke liye, pehle uska type likha jata hai, phir uska naam. Jaise, int myVar;.\n\nπ~Functions: Functions ek group of statements hote hain jo ek specific task perform karte hain. Function declare karne ke liye, pehle uska return type likha jata hai, phir uska naam, aur phir parentheses (). Jaise, void myFunction() { /* code */ }.\n\nπ~Loops: Loops ek sequence of statements ko bar bar execute karne ke liye use hote hain. C++ me teen types ke loops hote hain: for, while, aur do...while.\n\nπ~Conditionals: Conditionals ek specific condition ke basis par different code blocks execute karne ke liye use hote hain. C++ me if, else if, aur else statements use kiye jate hain conditions check karne ke liye.\n\nπ~Classes and Objects: C++ ek object-oriented programming language hai, isliye isme classes aur objects ka use hota hai. Class ek blueprint hoti hai jisme methods aur variables define kiye jate hain. Object class ka instance hota hai.",
"example": "#include <iostream>\n\nint main() {\n std::cout << \"Hello, AbhiVishrut is here!\";\n return 0;\n}",
"remcont": "Yeh tha C++ ka basic syntax.\n\nπ~#include <iostream>: Ye line iostream library ko include karti hai jo input-output operations ke liye use hoti hai.\n\nπ~int main(): Ye main function hai jahan se program start hota hai.\n\nπ~std::cout << \"Hello, AbhiVishrut is here!\";: Ye line console par βHello, World!β print karti hai.\n\nπ~return 0;: Ye line program ke end par 0 return karti hai, jo program successfully run ho gaya hai iska indication hota hai.\n\nI hope ye example helpful hoga."
},
{
"id": "4",
"name": "Run First Program",
"img": "https://raw.githubusercontent.com/abhivishrut/APIs/main/Images/ConstantImages/run_first_program.png",
"message": "π΄ C++ me βHello, World!β program likhne aur run karne ke steps diye hain:\n\nπ~C++ Program Likho: Sabse pehle, aapko ek text editor (jaise Notepad, Sublime Text, ya Visual Studio Code) me C++ program likhna hoga. Niche ek basic βHello, World!β program ka example diya gaya hai:",
"example": "#include <iostream>\n\nint main() {\n std::cout << \"Hello, World!\";\n return 0;\n}\n",
"remcont": "π~Program Save Karein: Program likhne ke baad, use .cpp extension ke sath save karein. Jaise, hello_world.cpp.\n\nπ~Program Compile Karein: Ab, Command Prompt ya Terminal open karein, aur jahan aapne apna program save kiya hai, wahan jaayein. Fir, g++ hello_world.cpp -o hello_world command type karein aur Enter press karein. Ye command aapke program ko compile karegi aur ek executable file generate karegi jiska naam hello_world hoga.\n\nπ~Program Run Karein: Program run karne ke liye, ./hello_world command type karein aur Enter press karein. Aapko βHello, World!β output dikhega.\n\nYe tha C++ me pehla program likhne aur run karne ka tarika."
},
{
"id": "5",
"name": "Comments in C++",
"img": "https://raw.githubusercontent.com/abhivishrut/APIs/main/Images/ConstantImages/comments.png",
"message": "π΄ C++ me comments code ki readability badhane ke liye use kiye jate hain. Ye compiler dwara ignore kiye jate hain. C++ me do tarah ke comments hote hain:\n\nπ~Single Line Comments: Single line comments ke liye // ka use kiya jata hai. Iske baad jo bhi line me likha jata hai, wo comment maana jata hai.\n\nπ~Multi-line Comments: Multi-line ya block comments ke liye /* se start hota hai aur */ se end hota hai. Iske beech jo bhi likha jata hai, wo comment maana jata hai.",
"example": "// Ye ek single line comment hai\nint x = 5; // Ye variable 'x' ko declare kar raha hai\n\n/*\nYe ek multi-line comment hai.\nIsme aap multiple lines me comment likh sakte hain.\n*/\nint x = 5;",
"remcont": "π΄ Comments ka use karke aap apne code ko samajhne me asaan bana sakte hain, aur dusre developers ke liye bhi ye helpful hota hai."
},
{
"id": "6",
"name": "Variables",
"img": "https://raw.githubusercontent.com/abhivishrut/APIs/main/Images/ConstantImages/variables.png",
"message": "π΄ C++ me variables ek tarah ke containers hote hain jo data store karte hain. Har variable ka ek naam (identifier) hota hai jisse usko refer kiya jata hai. Niche maine kuch basic types ke variables declare karne ke examples diye hain:\n\nπ~Integer (int): Ye integer values store karta hai. \n\nπ~Floating Point (float): Ye decimal point wale numbers store karta hai.\n\nπ~Double: Ye bhi decimal point wale numbers store karta hai, lekin iski precision float se jyada hoti hai.\n\nπ~Character (char): Ye single characters store karta hai.\n\nπ~String: Ye text strings store karta hai.\n\nπ~Boolean (bool): Ye true ya false values store karta hai.",
"example": "//Integer (int)\nint myVar = 5;\n\n//Floating Point (float)\nfloat myVar = 5.5;\n\n//Double\ndouble myVar = 5.5555555555;\n\n//Character (char)\nchar myVar = 'a';\n\n//String\nstd::string myVar = \"Hello, World!\";\n\n//Boolean (bool)\nbool myVar = true;",
"remcont": "Ye the C++ ke kuch basic variable types. Har ek variable type ka apna ek specific use hota hai, aur ye depend karta hai ki aap kis tarah ka data store karna chahte hain."
},
{
"id": "7",
"name": "Constant Variables",
"img": "https://raw.githubusercontent.com/abhivishrut/APIs/main/Images/ConstantImages/constant_variables.png",
"message": "π΄ C++ me constant variables ko const keyword ka use karke declare kiya jata hai. Ek baar constant variable ko value assign kar di gayi ho, toh uski value change nahi ki ja sakti. Yahan ek example diya gaya hai:",
"example": "const int myVar = 5;",
"remcont": "π΄ Isme, myVar ek constant variable hai jiska type int hai, aur uski value 5 hai. Ab agar aap myVar ki value change karne ki koshish karenge, toh compiler ek error dega.\n\nπ΄ Constant variables ka use tab kiya jata hai jab aapko kisi variable ki value ko protect karna ho ki wo accidentally change na ho jaye."
},
{
"id": "8",
"name": "Data Types",
"img": "https://raw.githubusercontent.com/abhivishrut/APIs/main/Images/ConstantImages/data_type.png",
"message": "π΄ C++ me kai tarah ke data types hote hain. Niche maine kuch basic data types ke examples diye hain:\n\nπ~Integer (int): Ye integer values store karta hai.\n\nπ~Floating Point (float): Ye decimal point wale numbers store karta hai.\n\nπ~Double: Ye bhi decimal point wale numbers store karta hai, lekin iski precision float se jyada hoti hai.\n\nπ~Character (char): Ye single characters store karta hai.\n\nπ~String: Ye text strings store karta hai.\n\nπ~Boolean (bool): Ye true ya false values store karta hai.",
"example": "//Integer (int)\nint myVar = 5;\n\n//Floating Point (float)\nfloat myVar = 5.5;\n\n//Double\ndouble myVar = 5.5555555555;\n\n//Character (char)\nchar myVar = 'a';\n\n//String\nstd::string myVar = \"Hello, World!\";\n\n//Boolean (bool)\nbool myVar = true;",
"remcont": "π΄ Ye the C++ ke kuch basic data types. Har ek data type ka apna ek specific use hota hai, aur ye depend karta hai ki aap kis tarah ka data store karna chahte hain. "
},
{
"id": "9",
"name": "Operators",
"img": "https://raw.githubusercontent.com/abhivishrut/APIs/main/Images/ConstantImages/operators.png",
"message": "π΄ C++ me kai tarah ke operators hote hain jo different operations perform karte hain. Niche maine kuch basic operators ke examples diye hain:\n\nπ~Arithmetic Operators: Ye basic mathematical operations perform karte hain.\n\nπ~Assignment Operators: Ye variables ko values assign karte hain.\n\nπ~Comparison Operators: Ye two values ko compare karte hain aur ek boolean (true ya false) value return karte hain.\n\nπ~Logical Operators: Ye logical operations (AND, OR, NOT) perform karte hain.",
"example": "//Arithmetic Operators\nint x = 5;\nint y = 2;\nint z = x + y; // Addition\nz = x - y; // Subtraction\nz = x * y; // Multiplication\nz = x / y; // Division\nz = x % y; // Modulus (remainder of division)\n\n//Assignment Operators\nint x = 5; // '=' is an assignment operator\n\n//Comparison Operators\nint x = 5;\nint y = 2;\nboolean z;\n\nz = (x == y); // Equal to\nz = (x != y); // Not equal to\nz = (x > y); // Greater than\nz = (x < y); // Less than\nz = (x >= y); // Greater than or equal to\nz = (x <= y); // Less than or equal to\n\n//Logical Operators\nbool x = true;\nbool y = false;\nbool z = x && y; // Logical AND\nz = x || y; // Logical OR\nz = !x; // Logical NOT",
"remcont": "π΄ Ye the C++ ke kuch basic operators. Har ek operator ka apna ek specific use hota hai, aur ye depend karta hai ki aap kis tarah ka operation perform karna chahte hain."
},
{
"id": "10",
"name": "String",
"img": "https://raw.githubusercontent.com/abhivishrut/APIs/main/Images/ConstantImages/strings.png",
"message": "π΄ C++ me strings ko std::string class ka use karke declare kiya jata hai. Yahan kuch examples diye gaye hain:\n\nπ~String Declare Karein: Sabse pehle, aapko ek string variable declare karna hoga.\n\nπ~String Concatenate Karein: Do strings ko jodne (concatenate) ke liye, aap + operator ka use kar sakte hain.\n\nπ~String Length Nikalein: String ki length nikalne ke liye, aap length() function ka use kar sakte hain.\n\nπ~String Access Karein: String ke specific character ko access karne ke liye, aap square brackets [] ka use kar sakte hain.",
"example": "//String Declare Karein\nstd::string myVar = \"Hello, World!\";\n\n//String Concatenate Karein\nstd::string str1 = \"Hello, \";\nstd::string str2 = \"World!\";\nstd::string str3 = str1 + str2; // \"Hello, World!\"\n\n//String Length Nikalein\nstd::string myVar = \"Hello, World!\";\nint len = myVar.length(); // 13\n\n//String Access Karein\nstd::string myVar = \"Hello, World!\";\nchar ch = myVar[0]; // 'H'",
"remcont": "0"
},
{
"id": "11",
"name": "User Input",
"img": "https://raw.githubusercontent.com/abhivishrut/APIs/main/Images/ConstantImages/user_input.png",
"message": "π΄ C++ me user se input lene ke liye std::cin ka use kiya jata hai. Yahan kuch examples diye gaye hain:\n\nπ~Integer Input: User se ek integer input lene ke liye, aap std::cin ka use kar sakte hain.\n\nπ~String Input: User se ek string input lene ke liye, aap std::getline() function ka use kar sakte hain.Multiple Inputs: User se multiple inputs lene ke liye, aap std::cin ka use kar sakte hain.\n\n",
"example": "//Integer Input\nint myVar;\nstd::cout << \"Ek number daalein: \";\nstd::cin >> myVar;\nstd::cout << \"Aapne daala: \" << myVar;\n\n//String Input\nstd::string myVar;\nstd::cout << \"Kuch likhiye: \";\nstd::getline(std::cin, myVar);\nstd::cout << \"Aapne likha: \" << myVar;\n\n//Multiple Inputs\nint var1, var2;\nstd::cout << \"Do numbers daalein: \";\nstd::cin >> var1 >> var2;\nstd::cout << \"Aapne daale: \" << var1 << \" and \" << var2;",
"remcont": "π΄ Ye the C++ me user input lene ke kuch basic tarike."
},
{
"id": "12",
"name": "if else",
"img": "https://raw.githubusercontent.com/abhivishrut/APIs/main/Images/ConstantImages/if_else.png",
"message": "π΄ C++ me if else statements conditions check karne ke liye use kiye jate hain. Yahan kuch examples diye gaye hain:\n\nπ~If Statement: if statement ek condition check karta hai, aur agar wo condition true hoti hai toh uske andar ka code execute hota hai.\n\nπ~Else Statement: else statement tab use hota hai jab if condition false hoti hai.\n\nπ~Else If Statement: else if statement tab use hoti hai jab aapko multiple conditions check karni hoti hain.",
"example": "//If Statement\nint x = 5;\nif (x > 0) {\n std::cout << \"x is positive\";\n}\n\n//Else Statement\n\nint x = -5;\nif (x > 0) {\n std::cout << \"x is positive\";\n} else {\n std::cout << \"x is not positive\";\n}\n\n//Else If Statement\nint x = 0;\nif (x > 0) {\n std::cout << \"x is positive\";\n} else if (x < 0) {\n std::cout << \"x is negative\";\n} else {\n std::cout << \"x is zero\";\n}",
"remcont": "π΄ Ye the C++ me if else statements ke kuch basic examples."
},
{
"id": "13",
"name": "while Loop",
"img": "https://raw.githubusercontent.com/abhivishrut/APIs/main/Images/ConstantImages/while_loop.png",
"message": "π΄ C++ me while loop ek tarah ka control flow statement hai jo ek block of code ko bar bar execute karta hai jab tak ki ek specific condition true hoti hai. Yahan ek example diya gaya hai:",
"example": "int i = 0;\nwhile (i < 5) {\n std::cout << i;\n i++;\n}",
"remcont": "π΄ Isme, loop i < 5 condition true hoti hai tab tak chalta hai, aur har iteration me i ki value 1 se badh jati hai. Iska output hoga 01234.\n\nπ΄ Ye tha C++ me while loop ka ek basic example."
},
{
"id": "14",
"name": "do while Loop",
"img": "https://raw.githubusercontent.com/abhivishrut/APIs/main/Images/ConstantImages/do_while_loop.png",
"message": "π΄ C++ me do while loop ek variant hai while loop ka jo kam se kam ek baar toh code execute karta hi hai, fir condition check karta hai. Yahan ek example diya gaya hai:",
"example": "int i = 0;\n do {\n std::cout << i;\n i++;\n } while (i < 5);",
"remcont": "π΄ Isme, loop pehle std::cout << i; aur i++; lines ko execute karta hai, fir i < 5 condition check karta hai. Agar condition true hoti hai, toh loop fir se run hota hai. Iska output hoga 01234.\n\nπ΄ Ye tha C++ me do while loop ka ek basic example."
},
{
"id": "15",
"name": "for Loop",
"img": "https://raw.githubusercontent.com/abhivishrut/APIs/main/Images/ConstantImages/for_loop.png",
"message": "π΄ C++ me for loop ek tarah ka control flow statement hai jo ek block of code ko specific number of times execute karta hai. Yahan ek example diya gaya hai:",
"example": "for (int i = 0; i < 5; i++) {\n std::cout << i;\n}",
"remcont": "Isme, for loop ke three parts hote hain:\n\nπ~Initialization: Yahan int i = 0; hai. Ye sirf ek baar execute hota hai jab loop start hota hai.\n\nπ~Condition: Yahan i < 5 hai. Ye condition har iteration ke pehle check hoti hai. Agar ye condition true hoti hai, toh loop ke andar ka code execute hota hai. Agar ye condition false hoti hai, toh loop stop ho jata hai.\n\nπ~Increment: Yahan i++ hai. Ye statement har iteration ke baad execute hoti hai.\n\nIska output hoga 01234.\n\nYe tha C++ me for loop ka ek basic example."
},
{
"id": "16",
"name": "continue Statement",
"img": "https://raw.githubusercontent.com/abhivishrut/APIs/main/Images/ConstantImages/continue_statement.png",
"message": "π΄ C++ me continue statement loop ke current iteration ko skip karne ke liye use kiya jata hai, aur control ko loop ke next iteration par transfer kar deta hai. Yahan ek example diya gaya hai:\n\n",
"example": "for (int i = 0; i < 10; i++) {\n if (i == 5) {\n continue;\n }\n std::cout << i << \"\\n\";\n}",
"remcont": "π΄ Isme, jab i ki value 5 hoti hai, toh continue statement execute hota hai, aur loop ka baaki ka code skip ho jata hai. Isliye, output me 5 print nahi hota. Baki sab numbers (0 se 4 aur 6 se 9) print hote hain.\n\nπ΄ Ye tha C++ me continue statement ka ek basic example."
},
{
"id": "17",
"name": "break Statement",
"img": "https://raw.githubusercontent.com/abhivishrut/APIs/main/Images/ConstantImages/break_statement.png",
"message": "π΄ C++ me break statement loop ya switch statement se bahar nikalne ke liye use kiya jata hai. Yahan ek example diya gaya hai:",
"example": "#include <iostream>\n\nint main() {\n for (int i = 0; i < 10; i++) {\n if (i == 5) {\n break;\n }\n std::cout << i << \"\\n\";\n }\n return 0;\n}",
"remcont": "π΄ Isme, jab i ki value 5 hoti hai, toh break statement execute hota hai, aur loop turant hi stop ho jata hai. Isliye, output me sirf 0 se 4 tak ke numbers print hote hain.\n\nπ΄ Ye tha C++ me break statement ka ek basic example."
},
{
"id": "18",
"name": "switch Loop",
"img": "https://raw.githubusercontent.com/abhivishrut/APIs/main/Images/ConstantImages/switch_statement.png",
"message": "π΄ C++ me switch statement multiple conditions check karne ke liye use kiya jata hai. Yahan ek example diya gaya hai:",
"example": "int day = 3;\nswitch (day) {\n case 1:\n std::cout << \"Monday\";\n break;\n case 2:\n std::cout << \"Tuesday\";\n break;\n case 3:\n std::cout << \"Wednesday\";\n break;\n default:\n std::cout << \"Invalid day\";\n}",
"remcont": "π΄ Isme, day variable ki value 3 hai. switch statement day variable ki value check karta hai, aur uske according case execute hota hai. Agar koi bhi case match nahi hota, toh default case execute hota hai.\n\nIska output hoga Wednesday.\n\nπ΄ Ye tha C++ me switch statement ka ek basic example."
},
{
"id": "19",
"name": "Exception Handling",
"img": "https://raw.githubusercontent.com/abhivishrut/APIs/main/Images/ConstantImages/exception%20handling.png",
"message": "π΄ C++ me exception handling errors ya unexpected events ko handle karne ke liye use kiya jata hai. Yahan ek example diya gaya hai:",
"example": "try {\n int x = -5;\n if (x < 0) {\n throw \"Number is negative\";\n }\n} catch (const char* msg) {\n std::cerr << msg;\n}",
"remcont": "π΄ Isme, try block me code likha jata hai jo potential error throw kar sakta hai. Agar koi error hota hai, toh throw statement use hoti hai error throw karne ke liye.\n\nπ΄ catch block me wo code likha jata hai jo error ko handle karta hai. Yahan, catch block error message ko print kar raha hai.\n\nYe tha C++ me exception handling ka ek basic example."
},
{
"id": "20",
"name": "try catch",
"img": "https://raw.githubusercontent.com/abhivishrut/APIs/main/Images/ConstantImages/try_catch.png",
"message": "π΄ C++ me try aur catch blocks exception handling ke liye use kiye jate hain. Yahan ek example diya gaya hai:",
"example": "try {\n int x = -5;\n if (x < 0) {\n throw \"Number is negative\";\n }\n} catch (const char* msg) {\n std::cerr << msg;\n}",
"remcont": "π΄ Isme, try block me code likha jata hai jo potential error throw kar sakta hai. Agar koi error hota hai, toh throw statement use hoti hai error throw karne ke liye.\n\nπ΄ catch block me wo code likha jata hai jo error ko handle karta hai. Yahan, catch block error message ko print kar raha hai.\n\nYe tha C++ me try aur catch blocks ka ek basic example."
},
{
"id": "21",
"name": "goto statement",
"img": "https://raw.githubusercontent.com/abhivishrut/APIs/main/Images/ConstantImages/goto_statement.png",
"message": "π΄ C++ me goto statement ek tarah ka control flow statement hai jo program control ko directly kisi aur statement par transfer kar deta hai. Yahan ek example diya gaya hai:",
"example": "#include <iostream>\nusing namespace std;\n\nint main() {\n int num = 0;\n\nlabel:\n num++;\n cout << num << \"\\n\";\n\n if (num < 5) {\n goto label;\n }\n\n return 0;\n}\n",
"remcont": "π΄ Isme, label: ek label hai jahan goto statement se jump kiya ja sakta hai. goto label; line se control directly label: line par chala jata hai. Isliye, ye code 1 se 5 tak ke numbers print karega.\n\nπ΄ Lekin dhyan dein ki goto statement ka use generally avoid kiya jata hai kyonki ye code ko padhna aur samajhna mushkil bana deta hai. Iski jagah loops (for, while, do while) ya functions ka use karna behtar hota hai.\n\nYe tha C++ me goto statement ka ek basic example."
},
{
"id": "22",
"name": "Array in c++",
"img": "https://raw.githubusercontent.com/abhivishrut/APIs/main/Images/ConstantImages/array.png",
"message": "π΄ C++ me array ek collection hota hai jisme same type ke multiple values store ki ja sakti hain. Yahan ek example diya gaya hai:",
"example": "int myArray[5] = {1, 2, 3, 4, 5};\n\nint firstElement = myArray[0]; // 1\nint secondElement = myArray[1]; // 2",
"remcont": "π΄ Isme, myArray ek integer array hai jisme 5 elements hain. Array ki values ko square brackets [] ke andar likha jata hai.\n\nπ΄ Array ke specific element ko access karne ke liye, uska index number use kiya jata hai. Dhyan dein ki array indexing 0 se start hoti hai. Yani ki pehla element 0 index par hota hai, dusra element 1 index par hota hai, aur aise hi aage badhta hai."
},
{
"id": "23",
"name": "Array Traversing",
"img": "https://raw.githubusercontent.com/abhivishrut/APIs/main/Images/ConstantImages/array_traversing.png",
"message": "π΄ C++ me array traversing ka matlab hai ki array ke har element ko ek ek karke access karna. Iske liye hum loop ka use kar sakte hain. Yahan ek example diya gaya hai:",
"example": "int myArray[5] = {1, 2, 3, 4, 5};\nfor (int i = 0; i < 5; i++) {\n std::cout << myArray[i] << \"\\n\";\n}",
"remcont": "π΄ Isme, for loop i ki value 0 se 4 tak chalta hai, aur har iteration me array ka ith element print hota hai. Iska output hoga 1, 2, 3, 4, 5 ek ek karke new line par.\n\nYe tha C++ me array traversing ka ek basic example."
},
{
"id": "24",
"name": "Multidimensional Array",
"img": "https://raw.githubusercontent.com/abhivishrut/APIs/main/Images/ConstantImages/multidimensional_array.png",
"message": "π΄ C++ me multidimensional array ek array hota hai jisme aur arrays hote hain. Yahan ek example diya gaya hai:",
"example": "int myArray[2][3] = { {1, 2, 3}, {4, 5, 6} };\n\n\nint firstElement = myArray[0][0]; // 1\nint secondElement = myArray[0][1]; // 2",
"remcont": "π΄ Isme, myArray ek 2D array hai jisme 2 rows aur 3 columns hain. Har row me ek 1D array hai jisme 3 elements hain.\n\nπ΄ Multidimensional array ke specific element ko access karne ke liye, uske row index aur column index ka use kiya jata hai."
},
{
"id": "25",
"name": "Structure in c++",
"img": "https://raw.githubusercontent.com/abhivishrut/APIs/main/Images/ConstantImages/structure.png",
"message": "π΄ C++ me structure ek tarah ka user-defined data type hota hai jisme hum different types ke variables ko ek sath store kar sakte hain. Yeh kuch is tarah se define kiya jata hai:\n\nstruct Student {\n string name;\n int roll_no;\n float marks;\n};\n\nπ΄ Yaha Student naam ka ek structure banaya gaya hai jisme teen members hain: name (string type), roll_no (integer type), aur marks (float type).\n\nπ΄ Ab hum is structure ka use karke ek variable create kar sakte hain:\nStudent s1;\n\nπ΄ Ab hum s1 ke members ko access kar sakte hain dot operator (.) ka use karke:\ns1.name = \"Abhivishrut Bishnoi\";\ns1.roll_no = 101;\ns1.marks = 89.5;\n\nπ΄ Ab s1 ke saare members me values assign ho chuki hain. Hum inhe print bhi kar sakte hain:\ncout << \"Name: \" << s1.name << endl; cout << \"Roll No: \" << s1.roll_no << endl; cout << \"Marks: \" << s1.marks << endl;",
"example": "0",
"remcont": "I hope yeh example aapko samajh me aayi hogi."
},
{
"id": "26",
"name": "Reference Variable",
"img": "https://raw.githubusercontent.com/abhivishrut/APIs/main/Images/ConstantImages/reference_variable.png",
"message": "π΄ C++ me reference variable ek tarah ka βaliasβ ya βnicknameβ hota hai jo kisi dusre variable ko refer karta hai. Yeh kuch is tarah se define kiya jata hai:\n\nint x = 10;\nint& ref = x;\n\nπ΄ Yaha x naam ka ek integer variable hai aur ref uska reference variable. ref ka use karke hum x ki value ko access ya modify kar sakte hain.",
"example": "cout << \"x: \" << x << endl; // Output: x: 10\ncout << \"ref: \" << ref << endl; // Output: ref: 10\n\nref = 20; // x ki value change kar rahe hain ref ke through\n\ncout << \"x: \" << x << endl; // Output: x: 20\ncout << \"ref: \" << ref << endl; // Output: ref: 20",
"remcont": "π΄ Dhyan dijiye ki jab hum ref ki value change karte hain to x ki value bhi change ho jati hai. Iska matlab ref sirf x ka reference hai, yeh x ka copy nahi hai.\n\nI hope yeh example aapko samajh me aayi hogi."
},
{
"id": "27",
"name": "Pointers in c++",
"img": "https://raw.githubusercontent.com/abhivishrut/APIs/main/Images/ConstantImages/pointers.png",
"message": "π΄ C++ me pointer ek special type ka variable hota hai jo kisi dusre variable ka address store karta hai. Yeh kuch is tarah se define kiya jata hai:\nint x = 10;\nint* ptr = &x;\n\nπ΄ Yaha x naam ka ek integer variable hai aur ptr uska pointer. ptr ka use karke hum x ki value ko access ya modify kar sakte hain.",
"example": "cout << \"Value of x: \" << x << endl;\ncout << \"Address of x: \" << &x << endl;\ncout << \"Value of ptr: \" << ptr << endl;\ncout << \"Value of x using ptr: \" << *ptr << endl;",
"remcont": "π΄ Dhyan dijiye ki jab hum *ptr ka use karte hain to hum x ki value ko access kar rahe hain. Isko dereferencing kehte hain."
},
{
"id": "28",
"name": "Function in c++",
"img": "https://raw.githubusercontent.com/abhivishrut/APIs/main/Images/ConstantImages/function.png",
"message": "π΄ C++ me function ek reusable code block hota hai jo kuch specific task ko perform karta hai. Yeh kuch is tarah se define kiya jata hai:\n\nπ΄ Yaha greet naam ka ek function banaya gaya hai jo ek string parameter leta hai aur βHello, [name]!β print karta hai. void iska return type hai jo iska matlab hai ki yeh function kuch return nahi karta.",
"example": "void greet(string name) {\n cout << \"Hello, \" << name << \"!\" << endl;\n}\n\nint main() {\n greet(\"World\");\n return 0;\n}\n\n\n//Ab hum is function ko call kar sakte hain:\nint main() {\n greet(\"Abhivishrut Bishnoi\"); // Function call with argument\n return 0;\n}",
"remcont": "π΄ Yeh program βHello, Abhivishrut Bishnoi!β print karega.\n\nI hope yeh example aapko samajh me aayi hogi."
},
{
"id": "29",
"name": "Parameterized Function",
"img": "https://raw.githubusercontent.com/abhivishrut/APIs/main/Images/ConstantImages/parameterized_function.png",
"message": "π΄ C++ me parameterized function ek aisa function hota hai jo ek ya ek se zyada parameters leta hai. Yeh kuch is tarah se define kiya jata hai:\n\nπ΄ Yaha add naam ka ek function banaya gaya hai jo do integer parameters leta hai (a aur b) aur unka sum return karta hai.",
"example": "int add(int a, int b) {\n return a + b;\n}\n\n\n//Ab hum is function ko call kar sakte hain:\nint main() {\n int sum = add(10, 20); // Function call with arguments\n cout << \"Sum: \" << sum << endl; // Output: Sum: 30\n return 0;\n}",
"remcont": "π΄ Yeh program βSum: 30β print karega.\n\nI hope yeh example aapko samajh me aayi hogi."
},
{
"id": "30",
"name": "Recursive Function",
"img": "https://raw.githubusercontent.com/abhivishrut/APIs/main/Images/ConstantImages/recursive_function.png",
"message": "π΄ C++ me recursive function ek aisa function hota hai jo khud ko hi call karta hai. Yeh kuch is tarah se define kiya jata hai:\n\nπ΄ Yaha factorial naam ka ek function banaya gaya hai jo ek integer parameter leta hai (n) aur uska factorial calculate karta hai. Agar n zero hai to yeh 1 return karta hai, warna yeh n multiply karta hai factorial(n - 1) se. Yaha factorial(n - 1) is function ka recursive call hai.",
"example": "int factorial(int n) {\n if (n == 0)\n return 1;\n else\n return n * factorial(n - 1);\n}\n\n\nAb hum is function ko call kar sakte hain:\nint main() {\n int result = factorial(5); // Function call with argument\n cout << \"Factorial: \" << result << endl; // Output: Factorial: 120\n return 0;\n}",
"remcont": "π΄ Yeh program βFactorial: 120β print karega.\n\nI hope yeh example aapko samajh me aayi hogi."
},
{
"id": "31",
"name": "Function Call By Value And Call By Reference",
"img": "https://raw.githubusercontent.com/abhivishrut/APIs/main/Images/ConstantImages/function_call_by_value_and_call_by_refernce.png",
"message": "π΄ C++ me function call by value aur call by reference do tarah se kiya jata hai.\n\nπ~Call by Value: Isme function ko variable ki copy pass ki jati hai. Iska matlab hai ki function ke andar jo changes hote hain wo original variable ko affect nahi karte.\n\n~In Example: Yaha increment function x ki copy le raha hai aur usme 1 add kar raha hai. Lekin yeh change main function ke x variable ko affect nahi karta.\n\nπ~Call by Reference: Isme function ko variable ka reference pass kiya jata hai. Iska matlab hai ki function ke andar jo changes hote hain wo original variable ko bhi affect karte hain.\n\n~In Example: Yaha increment function x ka reference le raha hai aur usme 1 add kar raha hai. Yeh change main function ke x variable ko bhi affect karta hai.",
"example": "//Call by Value\n#include <iostream>\nusing namespace std;\n\nvoid increment(int a) {\n a = a + 1;\n}\n\nint main() {\n int x = 5;\n increment(x);\n cout << x << endl; // Output: 5\n return 0;\n}\n\n\n//Call by Reference\nvoid increment(int& a) {\n a = a + 1;\n}\n\nint main() {\n int x = 5;\n increment(x);\n cout << x << endl; // Output: 6\n return 0;\n}",
"remcont": "I hope yeh example aapko samajh me aayi hogi."
},
{
"id": "32",
"name": "OOPs Concepts Introduction",
"img": "https://raw.githubusercontent.com/abhivishrut/APIs/main/Images/ConstantImages/oops_concept_introduction.png",
"message": "π΄ C++ me Object-Oriented Programming (OOPs) ek programming paradigm hai jo objects aur classes ke concepts par based hai. OOPs ke main concepts hain: Class, Object, Inheritance, Polymorphism, Abstraction, aur Encapsulation.\n\nπ~Class: Class ek blueprint ya template hota hai jisme methods aur variables define kiye jate hain.\n\nπ~Object: Class ke instance ko object kehte hain. Object class ke variables aur methods ka use kar sakta hai.\n\nπ~Inheritance: Inheritance ek process hai jisme ek class dusri class ke properties (methods aur variables) ko inherit kar sakti hai. Isse code reuseability badhti hai.\n\nπ~Polymorphism: Polymorphism ek concept hai jisme ek function ya operator different ways me behave kar sakta hai, depend karta hai ki wo kaise use kiya jaa raha hai.\n\nπ~Abstraction: Abstraction ka matlab hai ki complex systems ko simple sub-parts me break karna. Isse user ko sirf necessary details dikhai deti hain aur background details hide ho jati hain.\n\nπ~Encapsulation: Encapsulation ek process hai jisme data members aur member functions ko ek single unit me wrap kiya jata hai, jise class kehte hain. Isse data secure hota hai.",
"example": "0",
"remcont": "I hope yeh introduction aapko samajh me aayi hogi."
},
{
"id": "33",
"name": "Class And Object",
"img": "https://raw.githubusercontent.com/abhivishrut/APIs/main/Images/ConstantImages/class_and_object.png",
"message": "π΄ C++ me Class aur Object ka concept bahut important hai.\n\nπ~Class: Class ek blueprint ya template hota hai jisme methods aur variables define kiye jate hain. Yeh kuch is tarah se define kiya jata hai:\n\nπ~Object: Class ke instance ko object kehte hain. Object class ke variables aur methods ka use kar sakta hai.",
"example": "//Class\nclass Car {\npublic:\n string brand;\n string model;\n int year;\n};\n\n\n//Object\nCar car1;\ncar1.brand = \"Toyota\";\ncar1.model = \"Corolla\";\ncar1.year = 2020;",
"remcont": "~Class Example: Yaha Car naam ka ek class banaya gaya hai jisme teen public variables hain: brand, model, aur year.\n\n~Object Example: Yaha car1 naam ka ek Car class ka object banaya gaya hai aur usme values assign ki gayi hain."
},
{
"id": "34",
"name": "Static Members",
"img": "https://raw.githubusercontent.com/abhivishrut/APIs/main/Images/ConstantImages/static_members.png",
"message": "π΄ C++ me static members ek special type ke members hote hain jo class level par share kiye jate hain, na ki object level par. Iska matlab hai ki ek class ke sabhi objects ke liye static member sirf ek hi hota hai.\n\nπ΄ Static members ko static keyword ka use karke define kiya jata hai. Yeh kuch is tarah se define kiya jata hai:",
"example": "class MyClass {\npublic:\n static int count;\n};\n\nint MyClass::count = 0; // Static member ko initialize karna zaruri hota hai\n\n\nMyClass obj1, obj2;\nobj1.count = 5;\ncout << obj2.count << endl; // Output: 5\ncout << MyClass::count << endl; // Output: 5",
"remcont": "π΄ Yaha MyClass naam ka ek class banaya gaya hai jisme ek static integer member hai count.\n\nπ΄ Dhyan dijiye ki jab hum obj1.count ki value change karte hain to obj2.count aur MyClass::count ki value bhi change ho jati hai. Iska matlab count sirf ek hi hai jo sabhi objects ke sath share kiya jata hai."
},
{
"id": "35",
"name": "Non-Static Members",
"img": "https://raw.githubusercontent.com/abhivishrut/APIs/main/Images/ConstantImages/non_static_members.png",
"message": "π΄ C++ me non-static members wo members hote hain jo har object ke liye alag hote hain. Yeh kuch is tarah se define kiye jate hain:\n\nπ΄ Yaha Car naam ka ek class banaya gaya hai jisme teen non-static members hain: brand, model, aur year.",
"example": "class Car {\npublic:\n string brand; // Non-static member\n string model; // Non-static member\n int year; // Non-static member\n};\n\n\n//Ab hum is class ke objects bana sakte hain:\nCar car1, car2;\ncar1.brand = \"Toyota\";\ncar1.model = \"Corolla\";\ncar1.year = 2020;\n\ncar2.brand = \"Honda\";\ncar2.model = \"Civic\";\ncar2.year = 2022;",
"remcont": "π΄ Yaha car1 aur car2 naam ke do Car class ke objects banaye gaye hain aur unme alag-alag values assign ki gayi hain.\n\nπ΄ Dhyan dijiye ki car1 aur car2 ke members (brand, model, year) alag-alag hain. Iska matlab brand, model, aur year non-static members hain."
},
{
"id": "36",
"name": "Constructor And Destructor",
"img": "https://raw.githubusercontent.com/abhivishrut/APIs/main/Images/ConstantImages/constructor_and_destructor.png",
"message": "π΄ C++ me Constructor aur Destructor special type ke functions hote hain jo class ke objects ke creation aur destruction ke time automatically call hote hain.\n\nπ~Constructor: Constructor ek special type ka member function hota hai jo same name rakhta hai jaisa ki class ka name hota hai. Constructor automatically call hota hai jab koi object class ka banaya jata hai. Iska main use hota hai object ko initial state me set karne ke liye.\n\nπ~Destructor: Destructor bhi ek special type ka member function hota hai jo same name rakhta hai jaisa ki class ka name hota hai lekin uske samne tilde (~) sign hota hai. Destructor automatically call hota hai jab object out of scope ho jata hai ya delete kiya jata hai. Iska main use hota hai resources ko free karne ke liye.",
"example": "//Constructor\nclass Car {\npublic:\n Car() {\n cout << \"Car object has been created\" << endl;\n }\n};\n\n//Destructor\nclass Car {\npublic:\n Car() {\n cout << \"Car object has been created\" << endl;\n }\n ~Car() {\n cout << \"Car object has been destroyed\" << endl;\n }\n};",
"remcont": "~Constructor Example: Yaha Car naam ka ek class banaya gaya hai jisme ek constructor hai Car(). Jab hum Car class ka object banayenge to yeh message print hoga βCar object has been createdβ.\n\n~Destructor Example: Yaha Car naam ka ek class banaya gaya hai jisme ek destructor hai ~Car(). Jab Car class ka object destroy hoga to yeh message print hoga βCar object has been destroyedβ."
},
{
"id": "37",
"name": "Access Specifiers",
"img": "https://raw.githubusercontent.com/abhivishrut/APIs/main/Images/ConstantImages/access_specifiers.png",
"message": "π΄ C++ me Access Specifiers wo keywords hote hain jo ye specify karte hain ki class ke members ka scope kya hoga. C++ me teen types ke access specifiers hote hain: public, private, aur protected.\n\nπ~Public: Jab koi member public hota hai to usko class ke bahar se directly access kiya ja sakta hai.\n\nπ~Private: Jab koi member private hota hai to usko sirf class ke andar hi access kiya ja sakta hai.\n\nπ~Protected: Jab koi member protected hota hai to usko class ke andar aur uski derived classes me hi access kiya ja sakta hai.",
"example": "//Public\nclass MyClass {\npublic:\n int x; // Public member\n};\n\n\n//Private\nclass MyClass {\nprivate:\n int y; // Private member\n};\n\n\n//Protected\nclass Parent {\nprotected:\n int z; // Protected member\n};",
"remcont": "~public Example: Yaha x ek public member hai, isliye hum isko class ke bahar se access kar sakte hain.\n\n~private Example: Yaha y ek private member hai, isliye hum isko sirf class ke andar hi access kar sakte hain.\n\n~protected Example: Yaha z ek protected member hai, isliye hum isko Parent class ke andar aur Parent class ki derived classes me hi access kar sakte hain."
},
{
"id": "38",
"name": "Encapsulation",
"img": "https://raw.githubusercontent.com/abhivishrut/APIs/main/Images/ConstantImages/encapsulation.png",
"message": "π΄ C++ me Encapsulation ek bahut hi important concept hai Object Oriented Programming (OOPs) ka.\n\nπ΄ Encapsulation ka matlab hota hai data hiding. Iska main idea yeh hota hai ki class ke internal details ko bahar se hide kiya jata hai. Yeh karne ke liye hum class ke variables ko private ya protected access specifier se declare karte hain aur unhe access karne ke liye public methods (getters and setters) provide karte hain.\n\nYeh kuch is tarah se kiya jata hai:",
"example": "class Circle {\nprivate:\n double radius;\n\npublic:\n void setRadius(double r) {\n if (r >= 0)\n radius = r;\n else\n radius = 0;\n }\n\n double getRadius() {\n return radius;\n }\n\n double getArea() {\n return 3.14 * radius * radius;\n }\n};",
"remcont": "π΄ Yaha Circle naam ka ek class banaya gaya hai jisme radius naam ka ek private member hai. Iske liye setRadius aur getRadius naam ke do public methods hain jo radius ko set aur get karne ke liye use hote hain. getArea method circle ka area calculate karta hai."
},
{
"id": "39",
"name": "Inheritance",
"img": "https://raw.githubusercontent.com/abhivishrut/APIs/main/Images/ConstantImages/inheritance.png",
"message": "π΄ C++ me Inheritance ek bahut hi important concept hai Object Oriented Programming (OOPs) ka.\n\nπ΄ Inheritance ek process hai jisme ek class (child class ya derived class kehlate hain) dusri class (parent class ya base class kehlate hain) ke properties (methods aur variables) ko inherit kar sakti hai. Isse code reuseability badhti hai aur program structure improve hota hai.\n\nYeh kuch is tarah se kiya jata hai:",
"example": "class Vehicle { // Base class\npublic:\n string brand = \"Unknown\";\n void honk() {\n cout << \"Beep, beep!\" << endl;\n }\n};\n\nclass Car: public Vehicle { // Derived class\npublic:\n string model = \"Unknown\";\n};\n\n\nCar car1;\ncar1.brand = \"Toyota\";\ncar1.model = \"Corolla\";\ncar1.honk(); // Output: Beep, beep!\nstd::cout << car1.brand + \" \" + car1.model; // Output: Toyota Corolla",
"remcont": "π΄ Yaha Vehicle naam ka ek class banaya gaya hai jisme ek public variable brand aur ek public method honk hai. Car naam ki ek dusri class banayi gayi hai jo Vehicle class ko inherit kar rahi hai. Isliye Car class ke objects brand variable aur honk method ka use kar sakte hain."
},
{
"id": "40",
"name": "Multilevel Inheritance",
"img": "https://raw.githubusercontent.com/abhivishrut/APIs/main/Images/ConstantImages/multilevel_inheritance.png",
"message": "π΄ C++ me Multilevel Inheritance ek aisa concept hai jaha ek derived class dusri derived class se inherit hoti hai.\n\nYeh kuch is tarah se kiya jata hai:",
"example": "class Grandparent { // Base class\npublic:\n void gpFunc() {\n cout << \"Function of Grandparent class.\" << endl;\n }\n};\n\nclass Parent : public Grandparent { // Derived class\npublic:\n void pFunc() {\n cout << \"Function of Parent class.\" << endl;\n }\n};\n\nclass Child : public Parent { // Derived class\npublic:\n void cFunc() {\n cout << \"Function of Child class.\" << endl;\n }\n};\n\n\n// Ab hum Child class ka object banakar in sabhi functions ko call kar sakte hain:\nint main() {\n Child c;\n c.gpFunc(); // Output: Function of Grandparent class.\n c.pFunc(); // Output: Function of Parent class.\n c.cFunc(); // Output: Function of Child class.\n return 0;\n}",
"remcont": "π΄ Yaha Grandparent, Parent, aur Child naam ke teen classes hain. Parent class Grandparent class se inherit hoti hai aur Child class Parent class se inherit hoti hai. Isse multilevel inheritance kehte hain."
},
{
"id": "41",
"name": "Multiple Inheritance",
"img": "https://raw.githubusercontent.com/abhivishrut/APIs/main/Images/ConstantImages/multiple_inheritance.png",
"message": "π΄ C++ me Multiple Inheritance ek aisa concept hai jaha ek derived class ek se zyada base classes se inherit hoti hai.\n\nYeh kuch is tarah se kiya jata hai:",
"example": "class Parent1 { \npublic: \n void func1() { \n cout << \"Function of Parent1 class.\" << endl; \n } \n}; \n\nclass Parent2 { \npublic: \n void func2() { \n cout << \"Function of Parent2 class.\" << endl; \n } \n}; \n\nclass Child : public Parent1, public Parent2 { \npublic: \n void func3() { \n cout << \"Function of Child class.\" << endl; \n } \n};\n\n\n// Ab hum Child class ka object banakar in sabhi functions ko call kar sakte hain:\nint main() {\n Child c;\n c.func1(); // Output: Function of Parent1 class.\n c.func2(); // Output: Function of Parent2 class.\n c.func3(); // Output: Function of Child class.\n return 0;\n}",
"remcont": "π΄ Yaha Parent1, Parent2, aur Child naam ke teen classes hain. Child class Parent1 aur Parent2 classes se inherit hoti hai. Isse multiple inheritance kehte hain."
},
{
"id": "42",
"name": "Method Overloading",
"img": "https://raw.githubusercontent.com/abhivishrut/APIs/main/Images/ConstantImages/method_overloading.png",
"message": "π΄ C++ me Method Overloading ek bahut hi important concept hai.\n\nπ΄ Method Overloading ka matlab hota hai ki ek hi class me ek hi naam ke multiple methods hote hain lekin unke parameters alag-alag hote hain. Yeh kuch is tarah se kiya jata hai:",
"example": "class MyClass {\npublic:\n void display() {\n cout << \"Display without parameters\" << endl;\n }\n\n void display(int a) {\n cout << \"Display with one parameter: \" << a << endl;\n }\n\n void display(int a, int b) {\n cout << \"Display with two parameters: \" << a << \", \" << b << endl;\n }\n};\n\n\n// Ab hum in methods ko call kar sakte hain:\nint main() {\n MyClass obj;\n obj.display(); // Output: Display without parameters\n obj.display(5); // Output: Display with one parameter: 5\n obj.display(10, 20); // Output: Display with two parameters: 10, 20\n return 0;\n}",
"remcont": "π΄ Yaha MyClass naam ka ek class banaya gaya hai jisme display naam ke teen methods hain. Sabka naam same hai lekin parameters alag-alag hain."
},
{
"id": "43",
"name": "Method Overriding",
"img": "https://raw.githubusercontent.com/abhivishrut/APIs/main/Images/ConstantImages/method_overring.png",
"message": "π΄ C++ me Method Overriding ek bahut hi important concept hai Object Oriented Programming (OOPs) ka, jo inheritance ke sath use hota hai.\n\nπ΄ Method Overriding ka matlab hota hai ki derived class me base class ka method redefine karna. Yeh kuch is tarah se kiya jata hai:",
"example": "class Base { // Base class\npublic:\n void display() {\n cout << \"Display function of Base class\" << endl;\n }\n};\n\nclass Derived : public Base { // Derived class\npublic:\n // Overriding display() function of Base class\n void display() {\n cout << \"Display function of Derived class\" << endl;\n }\n};\n\n\n// Ab hum in methods ko call kar sakte hain:\nint main() {\n Base b;\n Derived d;\n\n b.display(); // Output: Display function of Base class\n d.display(); // Output: Display function of Derived class\n\n return 0;\n}",
"remcont": "π΄ Yaha Base aur Derived naam ke do classes hain. Derived class Base class se inherit hoti hai. Dono classes me display naam ka ek method hai. Lekin Derived class me display method Base class ke display method ko override kar raha hai."
},
{
"id": "44",
"name": "Polymorphism",
"img": "https://raw.githubusercontent.com/abhivishrut/APIs/main/Images/ConstantImages/polymorphism.png",
"message": "π΄ C++ me Polymorphism ek bahut hi important concept hai Object Oriented Programming (OOPs) ka.\n\nπ΄ Polymorphism ka matlab hota hai βmany formsβ. Iska matlab hai ki ek hi interface ya entity ka multiple forms ho sakte hain. C++ me mainly do types ke polymorphism hote hain: Compile time Polymorphism (jaise Method Overloading aur Operator Overloading) aur Runtime Polymorphism (jaise Method Overriding through Virtual Functions).\n\nπ~Method Overloading: Ek hi class me ek hi naam ke multiple methods hote hain lekin unke parameters alag-alag hote hain.\n\nπ~Method Overriding through Virtual Functions: Jab base class ka method virtual declared hota hai to derived class us method ko override kar sakti hai.",
"example": "//Method Overloading\nclass MyClass {\npublic:\n void display() {\n cout << \"Display without parameters\" << endl;\n }\n\n void display(int a) {\n cout << \"Display with one parameter: \" << a << endl;\n }\n\n void display(int a, int b) {\n cout << \"Display with two parameters: \" << a << \", \" << b << endl;\n }\n};\n\n\n//Method Overriding through Virtual Functions\nclass Base { // Base class\npublic:\n virtual void display() {\n cout << \"Display function of Base class\" << endl;\n }\n};\n\nclass Derived : public Base { // Derived class\npublic:\n // Overriding display() function of Base class\n void display() override {\n cout << \"Display function of Derived class\" << endl;\n }\n};",
"remcont": "I hope yeh explanation aapko samajh me aayi hogi."
},
{
"id": "45",
"name": "Friend Function",
"img": "https://raw.githubusercontent.com/abhivishrut/APIs/main/Images/ConstantImages/friend_function.png",
"message": "π΄ C++ me Friend Function ek special type ka function hota hai jo ek class ke private aur protected members ko access kar sakta hai.\n\nπ΄ Friend function ko friend keyword ka use karke declare kiya jata hai. Yeh kuch is tarah se kiya jata hai:",
"example": "class MyClass {\nprivate:\n int secret = 42;\n\npublic:\n friend void revealSecret(MyClass mc);\n};\n\nvoid revealSecret(MyClass mc) {\n cout << \"The secret is: \" << mc.secret << endl;\n}\n\n\n//Ab hum revealSecret function ko call kar sakte hain:\nint main() {\n MyClass obj;\n revealSecret(obj); // Output: The secret is: 42\n return 0;\n}",
"remcont": "π΄ Yaha MyClass naam ka ek class banaya gaya hai jisme secret naam ka ek private member hai. revealSecret naam ka ek friend function hai jo MyClass ke secret member ko access kar sakta hai.\n\nπ΄ Dhyan dijiye ki friend function class ke member nahi hota, isliye isko call karne ke liye object ki zarurat nahi hoti. Lekin yeh class ke private aur protected members ko access kar sakta hai."
},
{
"id": "46",
"name": "Virtual Function",
"img": "https://raw.githubusercontent.com/abhivishrut/APIs/main/Images/ConstantImages/virtual_function.png",
"message": "π΄ C++ me Virtual Function ek special type ka member function hota hai jo base class me declare kiya jata hai aur derived class me override kiya jata hai.\n\nπ΄ Virtual function ka main use hota hai runtime polymorphism enable karne ke liye. Yeh kuch is tarah se kiya jata hai:",
"example": "class Base { // Base class\npublic:\n virtual void display() {\n cout << \"Display function of Base class\" << endl;\n }\n};\n\nclass Derived : public Base { // Derived class\npublic:\n // Overriding display() function of Base class\n void display() override {\n cout << \"Display function of Derived class\" << endl;\n }\n};\n\n\n// Ab hum in methods ko call kar sakte hain:\nint main() {\n Base* ptr;\n Derived d;\n\n ptr = &d;\n ptr->display(); // Output: Display function of Derived class\n\n return 0;\n}",
"remcont": "π΄ Yaha Base aur Derived naam ke do classes hain. Derived class Base class se inherit hoti hai. Dono classes me display naam ka ek method hai. Lekin Derived class me display method Base class ke display method ko override kar raha hai.\n\nπ΄ Dhyan dijiye ki yaha humne Base class ka pointer ptr use kiya hai Derived class ke object d ko point karne ke liye. Jab hum ptr->display() call karte hain to Derived class ka display method call hota hai, na ki Base class ka. Yeh hota hai runtime polymorphism."
},
{
"id": "47",
"name": "Virtual Destructor",
"img": "https://raw.githubusercontent.com/abhivishrut/APIs/main/Images/ConstantImages/virtual_destructor.png",
"message": "π΄ C++ me Virtual Destructor ek special type ka destructor hota hai jo base class me declare kiya jata hai.\n\nπ΄ Virtual destructor ka main use hota hai runtime polymorphism enable karne ke liye, jisse jab derived class ka object delete hota hai to pehle derived class ka destructor call hota hai fir base class ka destructor call hota hai. Yeh kuch is tarah se kiya jata hai:",
"example": "class Base { // Base class\npublic:\n Base() {\n cout << \"Base class constructor\" << endl;\n }\n virtual ~Base() {\n cout << \"Base class destructor\" << endl;\n }\n};\n\nclass Derived : public Base { // Derived class\npublic:\n Derived() {\n cout << \"Derived class constructor\" << endl;\n }\n ~Derived() {\n cout << \"Derived class destructor\" << endl;\n }\n};\n\n\nAb hum in classes ke objects ko create aur delete karke dekh sakte hain:\nint main() {\n Base* ptr = new Derived();\n delete ptr;\n return 0;\n}\n\n\n// Yeh program yeh output dega:\nBase class constructor\nDerived class constructor\nDerived class destructor\nBase class destructor",
"remcont": "π΄ Yaha Base aur Derived naam ke do classes hain. Derived class Base class se inherit hoti hai. Dono classes me constructors aur destructors hain. Lekin Base class ka destructor virtual hai.\n\nπ΄ Dhyan dijiye ki jab hum delete ptr karte hain to pehle Derived class ka destructor call hota hai fir Base class ka destructor call hota hai. Yeh hota hai runtime polymorphism."
}
]