cpp derived data type

C++ Drived data types

Array
Function
Pointers
References

Arrays

The application of arrays in c++ is similar to c programming language. The only exception(error) is the way character arrays are initialized . when initializing a character array in ANSI C language, the compiler will allow us to declare the array size as the exact(correct) length of the string constant . for example

Drived Data types Arrays The Array in c++ are similar to the C language. For example

char string[5]="nitish"; is valid in ANSI C.

it assumes that the programmer intends to leave out the character \0 null in the definition.

but in c++ the size should be one longer than the number of characters in the string

char string[5]="jolo"; // its ok for c++

Functions

function have major changes in c++ programming. while some of these changes are simple, others are require a new way of thinking when organizing our programs. many of these modification and improvements were driven by the requirements of the object oriented concept of c++, some of these were introduced to make the c++ program more reliable and readable. all the features of c++ functions are discuss

pointers

pointers are declared and initialized as in c language example

int *iptr; // int pointers
iptr=&y; // address of y assigned to iptr
*iptr=10; // 10 assigned to y through indirection

c++ language adds the concept of the constant pointer and pointer to a constant

char * const ptr1="Nice"; //constant pointer

we can not modify the address that ptr1 is initialized to

int const *ptr1=&m; //pointer to a constant

ptr2 is declared as pointer to a constant. it can point to any variable of correct type, but the contents of what it points to cannot be changed pointer are extensively used in c++ for memory management and achieving polymorphism

  • C++ Dynamic Initialization of Objects
  • C++ Copy Constructor
  • C++ Dynamic Constructor
  • C++ Destructors
  • C++ Exercise
  • C++ Operator Overloading
  • C++ Overloading Unary Operators
  • Const pointer in C
  • Void pointer in c
  • C++ Overloading Binary Operators
  • C++ Overloading Binary Operators Using Friends
  • C++ Manipulation String Using Operators
  • C++ Rules for overloading operators
  • C++ Exercise
  • C++ Basic To class Type
  • C++ Class TO Basic Type
  • C++ One class To another class type
  • C++ Exercise
  • C++ Inheritance introduction
  • C++ Single Inheritance
  • C++ Multiple Inheritance
  • C++ Ambiguity Resolution in inheritance
  • C++ Hierarchical Inheritance
  • C++ Hybrid Inheritance
  • C++ Virtual Base Classes
  • C++ Exercise
  • C++ abstract class
  • C++ nesting of classes
  • C++ Exercise
  • C++ polymorphism
  • C++ Exercise
  • C++ pointers
  • C++ Pointers TO object
  • C++ this pointer
  • C++ Pointer to Derived class
  • C++ Virtual functions
  • C++ Exercise
  • C++ streams
  • C++ unformatted I/O operations
  • C++ Put() and get()
  • C++ getline() and write()
  • C++ Formatted console I/O
  • C++ Manipulators
  • C++ Exercise
  • C++ file handling
  • C++ file stream classes
  • C++ Open and closing file
  • C++ open using constructor
  • C++ open using open()
  • C++ Detecting End of file
  • C++ File modes
  • C++ File pointers and Manipulators
  • C++ Sequential I/O
  • C++ Reading and Writing
  • C++ Updating a File
  • C++ Error handling In File
  • C++ Command Line Arguments
  • C++ Exercise
  • C++ Template introduction
  • C++ Class Templates with multiple Parameters
  • C++ Function templates
  • C++ Function templates with multiple parameters
  • C++ member function Template
  • C++ Exercise
  • C++ Exception handling
  • C++ Basics of Exception Handling
  • C++ Exception Handling Mechanism
  • C++ Throwing Mechanism
  • C++ Catch Mechanism
  • C++ Catch all Exceptions
  • C++ Re-Throwing An Exception
  • C++ Specifying Exceptions
  • C++ Exercise