Refresh Your Knowledge in C++


Hi everyone!!! Today i was just thinking of C++ and tried to recollect. To my sadness, I can’t remember the basics. So, now I wish to share some of the basics which I’ve seen.

1.  Difference between C and C++

*C++ is Object Oriented.

*C++ uses bottom-up approach, While C uses top-down approach.

*C++ supports function overloading.

* Reference variable can be used in C++, Whereas C does not support.

*C++ support Classes

*C++ supports exception handling.

2. Operators that can not be overloaded in c++ are

* .(dot)

* ::

* ?:(ternary operator)

* sizeof()

3. Datatypes are

char – 1 byte

int – 2 bytes

short int – 2 bytes

float – 4 bytes

long int – 4 bytes

double – 8 bytes

4. Scope of variable

#include;

int a; // Global variable

void main()

{

int b; // Local Variables

static int c; // Static variable, which is initialized to 0 automatically

cout<

Output

0

5. = is used for assigning value to the variable

6. == is used for comparison

7. Types of operators

*Arithmetic operator (+,-,*,/,%)

*Compound assignment (+=, -=, *=, /=, %=, >>=, <, =, <= )

*Bitwise Operators ( &, |, ^, ~, <> )

*Logical operators ( !, &&, || )

* Conditional or Ternary operator (?:)

*sizeof() operator

* Dereference operator (.*)

* Scope resolution operator (::)

8. Basic input statement is "cin" and output statement is "cout"

9. Control structures

*simple if

* if..... else

*switch ()

*while()

*do..... while()

*for(;;)

*jump

*break

*continue

10. Call by value

The Value of the argument can be changed in the calling function, but its scope is within that calling function only.

11. Call by reference

The value of the argument is passed with address, so it'll affect in both called function and calling function

12. Array is the group of elements of same datatype.

eg.int a[5]- allocates memory and store 5 integer value.

13.  We can use Multi Dimensional array.

eg. int matrixA[3][3] - in this we can store 9 elements.

14. A string is defined as array of characters which is enclosed within double quotes.

eg. char name= "Tech Twinklers";

15.  Pointer is an address of variable.

16. A class is a collection of data variables and member function.

17.  An object is the instance of a class

18. There are three access specifiers, they are

*private, which is accessible only within its declared class

*protected, which can be accessed in its own class and in its inherited class.

*public, which can be accessed throughout the program.

19. Types of inheritance

Simple inheritance- Inherit the property of one base class

Multiple inheritance- Inherit the property from more than one base class.

Multi-Level inheritance

Hybrid inheritance

20. Polymorphism is the ability to overload the operator and functions.

21.  In function overloading, the function name will be same, but it differ in number of arguments and its types.

 

I hope it was useful for you all to recollect C++. If I've left any important concepts, kindly write that below in the comments section 🙂

You may also like

LEAVE A COMMENT

Welcome To TechTwinklers!

Tech Twinklers is a Tech Blog run by Students with an aspiring enthusiasm in Technology and Gaming. This Blog will bring News about the Modern Technology, Educational Advances, Campus Interviews, etc. So make sure you subscribe to our blog because we don't want you to miss a thing that is posted here..

We're on Facebook!