Hi,
I am vijay, I have a question on default constructor.

Question :

Is it possible to hide the default copy constructor provide by the compiler...?

Background :

If the user writes a parameterised construtor , then default constructor is automatically hidde.

I tried to modify the copy constuctor by passing the object by pointer and not by reference -> I expected a compiler error but no compiler error was thrown.

can any one explaine me why compiler didn't throw an error.

and why i tried to use copy constructor , the compiler used default copy contructor though i have overriden it by my custorm copy constructor.

am using borland (codegear ) compiler.

Please find the sample code below.

#include <tchar.h>
#include <iostream>
#include <conio.h>
using namespace std ;
//---------------------------------------------------------------------------


class base
{
public :
int i ;
base( ){i = 0 ; }
base(int val){i = val ;}
// This is interesting though i modified copy constructor to receive
// object pointer rather object reference as parameter , i didn't get
// compiler error.
base(base* baseptr){ this->i = baseptr->i ;}
};

int main()
{
base objone ;
// This statement will use default copy contructor and not the one which i have overriden.
// My question : isn't default copy constructor is hidden
base objtwo = objone ;
}
//---------------------------------------------------------------------------