A property as a parameter in a constructor?

Please support our C# advertiser: Intel Parallel Studio Home
Reply

Join Date: Oct 2007
Posts: 35
Reputation: Ratte is an unknown quantity at this point 
Solved Threads: 0
Ratte's Avatar
Ratte Ratte is offline Offline
Light Poster

A property as a parameter in a constructor?

 
0
  #1
Feb 5th, 2008
I am supposed to write a custom exception handling constructor. First, I need to write a read/write string property and then I write the constructor that somehow needs to accept this property as a parameter (among other things such as msg and inner exception).

Any ideas? This is how it is worded on a homework by the way.
Thanks.
Last edited by Ratte; Feb 5th, 2008 at 7:23 pm.
Reply With Quote Quick reply to this message  
Join Date: Aug 2006
Posts: 2,065
Reputation: Ramy Mahrous is just really nice Ramy Mahrous is just really nice Ramy Mahrous is just really nice Ramy Mahrous is just really nice 
Solved Threads: 256
Featured Poster
Ramy Mahrous's Avatar
Ramy Mahrous Ramy Mahrous is offline Offline
Postaholic

Re: A property as a parameter in a constructor?

 
0
  #2
Feb 6th, 2008
  1. class XYZ
  2. {
  3. string str;
  4. public string Str
  5. {
  6. get { return str; }
  7. set { str = value; }
  8. }
  9.  
  10. public XYZ(string str)
  11. {
  12. this.str = str;
  13. }
  14. }
BI Developer | LINKdotNET
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C# Forum


Views: 2142 | Replies: 1
Thread Tools Search this Thread



Tag cloud for C#
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC