View RSS Feed

Sanvi

  1. Copy constructors and assignement operators in c++

    by , 04-01-2013 at 09:41 AM
    Copy Constructor
    A copy constructor is a special constructor for a class/struct that is
    used to make a copy of an existing instance.

    The below are the syntaxes of the copy constructors


    Code:
    CopyConstructorExample( const CopyConstructorExample& other );
      CopyConstructorExample( CopyConstructorExample& other );
      CopyConstructorExample( volatile const CopyConstructorExample& other );
      CopyConstructorExample( volatile
    ...
    Categories
    Uncategorized
  2. Inheritane and Friend Functions

    by , 03-26-2013 at 10:22 AM
    The private and protected members of a class cannot be accessed from outside the same class
    but it is not applicable for FRIEND functions
    The friend functions or classes declared with the friend keyword.

    If we want to declare an external function as friend of a class, thus allowing this function to have access to the private and protected members of this class, we do it by declaring a prototype of this external function within the class, and preceding it with the ...
    Categories
    Uncategorized