Guys im not abble to understand cpy constructor in C++...
Im a rookie in c++ n currently doing engg First year....
I hav read many of online copy constructor programs but it was of no use.... Confusion still exist
I want to know basic use of it, how t use it , and wht r its advantages...
Please explain me this in easy language....
thnx
__________________
!!!From DusT it StartS...... to DusT will EnD!!!!
DusT = ME
Rate me if was clear to you
Advertisements. Register and be a member of the community to get rid of them.
Man...for First year engg in Mumbai university..stick to the textboks..dont go online...
coz we guys r learning really basic stuff..even some wrong stuff..stuff dat has not been in use nowadays
Neways..get E.Balaguruswamy and study copy constructors
I dont have my copy lying around..but from what i remember..
It can be used to create a an object that is a copy of an already defined object..i.e. with class variabled given values.
Ok..found it..u sure are lucky..it was near my PC..page 139,balaguruswamy:
a copy constructor is use to declare and initialize an object from anoder object
i. Integer i2(i1);
this would define object i2 and initailize its values to dat of i1 variables
u cud also use integer i2=i1
this statements wont work if u havent defined a copy constructor.
i assume u know a constructor integer i3(10,50) wud initialize i3 variables to 10,50..in d copy constructor case..it wud give dem values of the object in the bracket...got it??
BTW..how does this come under open source??
__________________
If u think u r right...u r a bad thinker!
Thnx alot jatin....
it was really help ful....
but i still want to undergo few more examples...
problem is i dont hav balguruswamy,
actually i was confused were to post this thread so i did open source....
Please if u hav any more examples post here....
THNX
__________________
!!!From DusT it StartS...... to DusT will EnD!!!!
DusT = ME