CPlusPlus-Training (In-Depth)
- C philosophy (data + algo)
- Language Growth
- Compiler
- Compilation stages (Source Code -> Object Code -> Executable File)
- File extension
- GCC Commands
# compile source file without linking
# (source file -> object file)
g++ -c source_file.cpp
# linked object file with header and crteate executable file
# (object file -> executable file)
g++ object_file.o -o executable_file.exe
# compile and create executable file at once
# (source file -> executable file)
g++ source_file.cpp -o executable_file.exe
# run the code
./executable_file.exe
- Hello World Code
main()
Function
- minimun code in source file
- alternate ways to write
main()
- Commants
- Single Line Commants
/* */
- Multi line Commants
//
- Source Code Formatting
- Program and Process
- Process Memory Allocation in OS
cout
and printf
cout
Concatenation
endl
and \n
cin
and scanf
- preprocessor directives
- #include <math.h> and
- #define (macro)
- namespace
- using
- variable declaration
- Integer types
sizeof()
operator
- limits
signed
integers
unsigned
integers
- overflow problem
- variable initialization
- C style initialization
=
- constructor initialization
()
- uniform initialization
{}
- integer literals
- decimal
- hexadecimal
- octal
- binary
- cout manipulators
- format specifier in c
- Memory resources lock and unlock (Garbage value concept)
char
wchar_t
char16_t
char32_t
- ASCII
- Unicode
- Unicode as identifier
cin.get()
cout.put()
- floating type
- Scientific Notation
- float limitations
- float opperations
bool
auto
decltype
string
- Operators
- Assignment Operator
=
- Arithmetic Operators
+
, -
, *
, /
, %
- Compound Operators
+=
, -=
, *=
, /=
, %=
, >>=
, <<=
, &=
, ^=
, |=
- Increment and Decrement
++
, --
- Comparison Operators
==
, !=
, >
, <
, >=
, <=
- Logical Operators
!
, &&
, ||
- Conditional Ternary Operator
?
- Precedence of Operators
- Type Conversion
- Implicit Type Conversion
- Conversion on Initialization
- Conversion in Expessions
- Conversion in Passing Arguments
- Type Casting
(type) value
type (value)
static_cast<type> (value)
- Functions
- Using a function (Library Functions)
- User define functions
- Function declaration
- Function call
- Parameters
- Return Type
- Function Execution
- Memory Allocation of Local Variables (Stack)
- Function Variations
- Ambiguity in function call
- Type Conversion in Passing Arguments
- Flow Control
- if-else
- for
- while
- do while
- switch
- comma
,
operator
- Array
- array declearation
- memory allocation
- sizeof array
- indexing
- initialization
- uniform initialization
{}
- default value
- Function
- Pass by value
- Pass by Referance
- Array Traversal
- For each loop / range based for loop
- Aliasing in for loop
- Pass array in function parameters
- Charactor Array
- null charactor
\0
- Create length function (strlen)
- Create copy function (strcpy)
- Create comparison function (strcmp)
- Create concatenate function (strcat)
- memory allocation in stack
- address of operator
&
- pointers declearation
- dereference operator
*
- create pointer using integer variable
- Pointers memory resloving
- Pointers arithmetics
ptr++
ptr--
*ptr++
*(ptr++)
(*ptr)++
++*ptr
*++ptr
*(++ptr)
++*ptr++
(++*ptr)++
++(*ptr++)
++*--ptr++
- Array Pointers
- Array element access using pointers
- Pointer in function return type
- Dynemic memory allocation
new
*
const int* ptr = &var;
int* const ptr = &var;
const int* const ptr = &var;
// Both are same
const int *ptr = &var;
int const *ptr = &var;
- Deallocate Dynamic memory
- Add element to static Array
- Pointer to Pointers
- String
- initialization
size()
length()
at()
operator[]
front()
back()
operator+=
append()
insert()
push_back()
pop_back()
- 2D Array
- Declaration
- Initialization
- Uniform Initialization
- Memory Allocation
- 2D Array with pointerm
- Different size array
- Non-continous memory allocation
- Multi Dimentional Array
- Add element to dynamic Array (vector)
- remove element to dynamic Array (vector)
- Structure -
struct
- Declaration
- List Initialization
- Uniform Initialization
- Global and Local Struct
- Unnamed Struct
- Memory Allocation / Size of Struct
- Array of Struct (SOA)
- Struct of Array (AOS)
- Struct Pointer
->
operator
- Struct in heap
- Union -
union
- Declaration
- Initialization
- Memory Allocation / Size of Union
- Example of union
- Unnamed Union
- Nested Union
- Anonymous Union
- Enumeration -
enum
- Declaration
- Initialization
- Enum to int
- Anonymous Enum
- Enum class
- revision of dynamic array
- add element
- remove element
- double the size
- vector example
push_back()
pop_back()
size()
capacity()
cstring
header
strlen()
strcpy()
strcmp()
strcat()
strchr()
cctype
header
isalnum()
isalpha()
isdigit()
islower()
isupper()
ispunct()
isspace()
toupper()
tolower()
- file handling
ofstream
open()
method
- open using constructor call
- create file / overwrite file
- write using
<<
operator
- append text using
ios::app
close()
method
- create
csv
file
ifstream
open()
method
- open using constructor call
- read file using
>>
operator
- read lines using
getline()
- create function for read a specific line
- read data from
csv
filearee
- File Handling
- read string and convert to structure
- implement search function for file
fstream
ios::in
ios::out
ios::app
- read and write at same time
eof()
fail()
good()
bad()
Project 1 - Bank Application
- Function Prototypes
- Functions to process array (const pointers)
- Function using Array Ranges
- Return c-string
- Recursion
- Inline Function
- Macro Function
- Const reference in parameter
- Return reference
- Return pointer
- Default Arguments
- Function Templates
- Explicit Specialization
- Trailing return type
->
- Namespace
namespace
- scope resolution operator
::
using
- namespace aliasing
- Classes
class
declaration
class
vs struct
- member variables
- member methods
- object
- access modifiers
- Constructor
- Default Constructor
- Parameterized Constructor
- Constructor Overloading
this
pointer
- Data Hiding
- Encapsulation
Cube c1; // Default Constructor
Cube c2(); // Function Declaration (Object Not Created)
Cube c3(10); // Parameterized Constructor
Cube c4{}; // Uniform Initialization with Default Constructor
Cube c5{10}; // Uniform Initialization with Parameterized Constructor
Cube c6 = {}; // Assignment Initialization with Default Constructor
Cube c7 = {10}; // Assignment Initialization with Parameterized Constructor
Cube c8 = 10; // Default Constructor (works if class have only one data member)
- Distructor
- Object in heap using
new
& delete
- Life of an Object
- In block
- In stack
- In heap
Day 35 - Extra Class (PDF)
- Return array of string
getline()
vs cin.getline()
- Return address of local stack variable
- Access the value of deallocated memory
- Member initialization in constructors
- Const member
- Static Variables
- Static Methods
- Scope
- Const Member Functions
- Copy Constructor
- why const in parameter
- why &obj in parameter
- Operator Overloading
- operator[] for access array element
- operator+ for array concat
- Copy Assignment
- Inharitance
- single
- multilevel
- multiple
- hierarchical
- hybrid
- visibility mode
- public inharitance
- protected inharitance
- private inharitance
- constructor call sequence
- distructor call sequence
- constructor parameters
- variable ambiguity resolution using virtual base class
- method ambiguity resolution
- using virtual base class
- overriding
- overriding and scope resolution
::
- Polymorphism
- Compile Time Polymorphism / Early Binding / Static linking
- Function overloading
- Operator overloading
- Run Time Polymorphism / Late Binding / Dynamic Binding or Linking
- Friend Functions
- Abstraction
- Pure Virtual Functions
- Abstract Classes