Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Clarify a concept

Status
Not open for further replies.

bearsite4

Programmer
Sep 29, 2001
79
AU
I remember reading that with parameters are passed:
1. value for primitives, strings and one other
2. reference for objects

So, generally with constructors, you should do an assign if it takes any object parameters to prevent corruption of your object.

Is this correct?
 
Could you clarify what you are trying to say here.
Maybe then I can help you ...

BobbaFet Everyone has a right to my opinion.
E-mail me at cwcon@programmer.net
Be a nice guy 'n press that little ol' button
VVV---(this one) for me ;-)
 
What I meant was that (I'm not entirely sure but I think) when functions/procedures expect a object parameter, that parameter is passed by reference.

So given a class definition:

//class field
private
o1: object;

The constructor should have:

constructor s( o: TObject );
begin
o1.assign( o );
end;

instead of:

o1 := o;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top