Content deleted Content added
→Copy constructors: KB 1 Tags: Reverted Mobile edit Mobile web edit |
Undid revision 1056847156 by 105.112.16.8 (talk) |
||
Line 52:
{{see also|Copy constructor (C++)}}
Like C++, Java also supports "Copy Constructor". But, unlike C++, Java doesn't create a default copy constructor if you don't write your own. Copy constructors define the actions performed by the compiler when copying class objects. A Copy constructor has one formal parameter that is the type of the class (the parameter may be a reference to an object). It is used to create a copy of an existing object of the same class. Even though both classes are the same, it counts as a conversion constructor.
While copy constructors are usually abbreviated copy ctor or cctor, they have nothing to do with class constructors used in .NET using the same abbreviation.
=== Conversion constructors ===
|