CFanatic

Go Back   CFanatic > Programming > C# Programming

Join CFanatic Forum Now

Beginners Question on 'return' topic posted under C# Programming which is a part of Programming category in CFanatic Forum
Reply
 
Thread Tools Display Modes
  #1  
Old 09-20-2006, 04:58 AM
Junior Member
 
Join Date: Sep 2006
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
MartijnMulder is on a distinguished road
| More
Beginners Question on 'return'

I just want to be sure about this. When I have code like this:

//data member
System.Drawing.Drawing2D.GraphicsPath graphicspath=new
System.Drawing.Drawing2D.GraphicsPath();

//method
public System.Drawing.Drawing2D.GraphicsPath GetGraphicsPath()
{
return graphicspath;

}

there is a reference, a pointer returned to 'graphicspath' and NOT a copy of
the object?
Reply With Quote
  #2  
Old 12-08-2006, 02:33 PM
Junior Member
 
Join Date: Sep 2006
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Essial is on a distinguished road
| More
Re: Beginners Question on 'return'

I believe it returns a copy, not the original object. Don't hold me to it but typically if you want pointers returned, you should declare the function's result as a pointer. Please note that just about any use of pointers requires you to tag the function as "unsafe" for obvious reasons. C# tends to lend itself to stability versus efficiency. Its much safer to return a copy of an object than to define a pointer across functions.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
I want to return the date a week ago from today Rocket452 C# Programming 3 01-23-2009 05:16 AM
question about so files ftom2 C++ Programming 1 08-18-2008 02:28 AM
Functions that return two values psppb C++ Programming 2 02-12-2008 10:11 PM
C# debatable question MartijnMulder C# Programming 2 01-06-2007 12:42 AM
sorting question John C++ Programming 0 09-30-2006 04:57 AM

 

Advertisement

CFanatic Search
Custom Search

Advertisement

All times are GMT -5. The time now is 03:58 PM.



Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO ©2010, Crawlability, Inc.
Cfanatic.com is a premier member of the IDG TechNetwork. For advertising opportunities contact here
Get Paid for Working on Projects Matching Your Expertise at Go4Expert's Jobs Board