Cpp Tutorial: Friend function and friend class in C++
In this chapter we shall learn about below topics: 1. Friend Introduction. 2. Friend Function 3. Example 1: Program to add 2 using a friend function. 4. Example 2: 5. Friend Class 1. Friend Function Introduction We know that C++ is a Object Oriented Programming language. It supports data hiding. i.e making data members private […]
Cpp Tutorial: Cpp this pointer in C++
In this chapter we shall learn about below topics: 1. What is this pointer in C++? 2. Where is “this” pointer is accessible? Usage of “this” pointer: 1. Usage 1 2. Usage 2 3. Usage 3 What is this pointer in C++? “this” pointer holds the address of the current object that is being called. […]
Cpp Tutorial: C++ Size of an object in C++
1. Where are member functions stored in C++ 2. Introduction to size of object. 3. Size of object without structure padding 4. Size of object with structure padding 5. Size of object with static data members. 6. Size of object with virtual function 7. Size of object with Inheritance 8. Size of Empty Class in […]
Cpp Tutorial: C++ Access specifiers or Modifiers
Access specifiers are used to implement most important concept in C++. i.e Data Hiding. We shall discuss how access specifiers will help in Data Hiding at the end of the chapter. It is usual practice that we make Data members as private and expose them to the programmer by using public getters and setters. There […]
Cpp Tutorial: Cpp Member function and different ways to initialize
In this chapter we shall learn about: 1. Defining member functions inside of the class 2. Defining member functions outside of the class 3. Characteristic of member functions 4. Inline member functions We know that a class has data members and member functions. In this chapter we shall learn how to declare a member functions […]
Cpp Tutorial: C++ classes and objects
Below are the topics covered in this chapter 1. Classes in C++ 2. Declaring objects 3. The dot operator 4. The arrow operator 1. Classes in C++ Classes in C++ are similar to structures in C. They are used to pack data-members and member functions. The variables defined inside a class are called as data-members. […]
Cpp Tutorials: C++ Storage Classes
Below are the different Storage Classes available in C++. We shall see all these storage classes in this chapter. 1. Automatic Storage Class 2. External Storage Class 3. Static Storage Class 4. Register Storage Class 5. Mutable Storage Class 1. Automatic Storage Class Keyword: auto Lifetime: Function Block Visibility: Local Initial Value: Garbage It is […]
Cpp Tutorial: C++ all about Strings
1. Introduction 2. String object in C++ 3. String relational operators 4. String modification functions 5. String attribute functions 6. Accessing string elements 7. Comparing string functions 1. Introduction String is a sequence of characters. Every string should be terminated by NULL character ‘\0’. In C style, an extra space need to be allocated to […]
Cpp Tutorial: C++ all about Arrays.
In this chapter we shall study about following topics: 1. One Dimensional array 2. Characteristics of an array 3. Accessing array elements through pointers 4. Arrays of pointers 5. Passing a single array element to a function 6. Passing whole array to a function 7. Two dimensional array An array is a collection of elements […]
Cpp Tutorial: C++ Functions
In this chapter we shall study about: 1. Function prototype declaration 2. Function Definition 3. Function call 4. Actual and formal arguments 5. Return statement. 6. Call by value 7. Call by address 8. Call by reference 9. Default arguments 10. Inline functions 11. Function Overloading 12. Recursion Function While developing software applications, a larger […]