We will be discussing major topics here and actually difficult ones. You must know basic OOPs.
C structures Vs C++ Classes
General structure of classes
Visibility labels(Public, private, protected
Some terms and their meaning
# | User | Rating |
---|---|---|
1 | tourist | 3985 |
2 | jiangly | 3814 |
3 | jqdai0815 | 3682 |
4 | Benq | 3529 |
5 | orzdevinwang | 3526 |
6 | ksun48 | 3517 |
7 | Radewoosh | 3410 |
8 | hos.lyric | 3399 |
9 | ecnerwala | 3392 |
9 | Um_nik | 3392 |
# | User | Contrib. |
---|---|---|
1 | cry | 169 |
2 | maomao90 | 162 |
2 | Um_nik | 162 |
4 | atcoder_official | 161 |
5 | djm03178 | 158 |
6 | -is-this-fft- | 157 |
7 | adamant | 155 |
8 | awoo | 154 |
8 | Dominater069 | 154 |
10 | luogu_official | 150 |
Object Oriented Programming Notes(C++)
We will be discussing major topics here and actually difficult ones. You must know basic OOPs.
We know structures can be used to create user-defined data types in C and C++. But then why we need classes? We can have functions, constructors, etc in structures as well but what differentiates it from classes are lack of abstraction and inheritance(And actually many other things as well). We can hide certain members from outside world(abstraction) in a class but we can't do anything like this in structures. Also, we cannot overload an operator here. For example
struct complex{
float x,y;
};
// Structure for a complex number of form x+iy(i stands for iota)
complex c1,c2;
c1.x=1;
c1.y=2;
c2.x=3;
c2.y=3;
// c1=1+2i, c2=3+3i
complex c3=c1+c2;//Illegal statement in C because we cannot add these two structures.
class className{
private:
variable declaration;
function declaration;
public:
variable declaration;
function declaration;
};
By default, all members are private.
Rev. | Lang. | By | When | Δ | Comment | |
---|---|---|---|---|---|---|
en29 | abdude824 | 2022-08-10 12:46:07 | 2 | (published) | ||
en28 | abdude824 | 2022-08-10 12:45:45 | 64 | Reverted to en26 | ||
en27 | abdude824 | 2022-07-21 14:19:23 | 64 | (saved to drafts) | ||
en26 | abdude824 | 2021-09-20 10:08:43 | 950 | |||
en25 | abdude824 | 2021-08-25 12:30:52 | 97 | |||
en24 | abdude824 | 2021-08-22 17:51:00 | 369 | |||
en23 | abdude824 | 2021-08-21 09:49:20 | 38 | Tiny change: ' type.\n\n\n## Inh' -> ' type.\n\n**Type Conversion**\n\nTo be updated\n\n## Inh' (published) | ||
en22 | abdude824 | 2021-08-20 21:07:00 | 480 | |||
en21 | abdude824 | 2021-08-20 19:56:08 | 1363 | |||
en20 | abdude824 | 2021-08-20 19:41:14 | 467 | |||
en19 | abdude824 | 2021-08-20 19:34:03 | 1012 | Tiny change: ' form a+$i%b">\n\n</s' -> ' form a+$i$b">\n\n</s' | ||
en18 | abdude824 | 2021-08-20 17:44:31 | 2 | Tiny change: ' would be suing this t' -> ' would be using this t' | ||
en17 | abdude824 | 2021-08-20 15:20:16 | 126 | |||
en16 | abdude824 | 2021-08-20 13:19:28 | 16 | |||
en15 | abdude824 | 2021-08-20 13:17:47 | 762 | |||
en14 | abdude824 | 2021-08-20 12:51:38 | 764 | |||
en13 | abdude824 | 2021-08-20 12:36:39 | 103 | |||
en12 | abdude824 | 2021-08-20 12:29:44 | 1758 | |||
en11 | abdude824 | 2021-08-20 11:57:34 | 2049 | |||
en10 | abdude824 | 2021-08-20 11:43:02 | 130 | |||
en9 | abdude824 | 2021-08-19 22:32:45 | 907 | |||
en8 | abdude824 | 2021-08-19 21:26:19 | 2653 | |||
en7 | abdude824 | 2021-08-19 20:57:41 | 1054 | |||
en6 | abdude824 | 2021-08-19 15:24:19 | 3 | |||
en5 | abdude824 | 2021-08-17 21:33:53 | 894 | Tiny change: '/articles/n5kflb4dv5c2koi41uk2.png)\n</' -> '/articles/qnvv0uasstduy2zueqo2.png)\n</' | ||
en4 | abdude824 | 2021-08-17 10:59:06 | 4 | Tiny change: 'ask/1138\n~~~~~\n#' -> 'ask/1138\n\n~~~~~\n#' | ||
en3 | abdude824 | 2021-08-17 10:58:45 | 5290 | |||
en2 | abdude824 | 2021-08-17 10:37:59 | 559 | |||
en1 | abdude824 | 2021-08-17 10:31:10 | 1201 | Initial revision (saved to drafts) |
Name |
---|