Click here to Skip to main content
15,887,214 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Design pattern – Inversion of control and Dependency injection[^]

I am sorry if it is silly question

in the constructor methodology paragraph ...there is

C#
public class clscustomer
{
 private Iaddress _address;
  public clscustomer(Iaddress obj);
      {
          _address=obj;
      }

..........
}

I think Iaddress _address; and Iaddress obj are same ?what is the difference between them?
Posted
Updated 12-May-12 22:21pm
v3

1 solution

The constructor is used to set the private variable which isn't visible outside the class. Valid scope for the parameter obj is only the constructor.

Yes, after succesfully calling the constructor the private field should contain the same object.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900