Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / CLR / November 2007

Tip: Looking for answers? Try searching our database.

Pointers in VC.Net

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Dipesh_Sharma - 28 Sep 2007 07:22 GMT
Hi All,
I am new on this VC.Net platform, So please dont mind to my question.
In VC++ we can use pointers very easily, but i want to know if we can use:
int *ptr = new int[10];
and
char * in VC.net.
If we cant use them whats the alternate option for them. Please explain me
this or provide me link to answers to these question.

Thanks.
Willy Denoyette [MVP] - 28 Sep 2007 08:48 GMT
> Hi All,
> I am new on this VC.Net platform, So please dont mind to my question.
[quoted text clipped - 6 lines]
>
> Thanks.

This is not the right NG to ask VC question, please post to the VC NG
instead.

Willy.
Ben Voigt [C++ MVP] - 03 Oct 2007 18:47 GMT
>> Hi All,
>> I am new on this VC.Net platform, So please dont mind to my question.
[quoted text clipped - 6 lines]
>> me
>> this or provide me link to answers to these question.

That works.  There's also a syntax for pointers into .NET objects, which
looks like this:

array<int>^ a = gcnew array<int>(10);
interior_ptr<int> ptr = &a[0];

>> Thanks.
>
> This is not the right NG to ask VC question, please post to the VC NG
> instead.

which is microsoft.public.dotnet.languages.vc

> Willy.
Andrew Faust - 30 Oct 2007 07:34 GMT
Ben answered the question already. However, I just wanted to point out that
you may not actually need to create a pointer for your specific needs
anymore. The .Net platform supports passing objects around as references
automatically. For example you can do this:

MyClass class = new MyClass();
object o1 = class;
object o2 = o1;
object o3 = o2;
MyClass class2 = o3;

After that sequence of events class, o1, o2, o3 & class2 will all be
pointing at the exact same instance of MyClass object.

Signature

Andrew Faust
andrew[at]andrewfaust.com
http://www.andrewfaust.com

> Hi All,
> I am new on this VC.Net platform, So please dont mind to my question.
[quoted text clipped - 8 lines]
>
> Thanks.
Ben Voigt [C++ MVP] - 08 Nov 2007 15:27 GMT
> Ben answered the question already. However, I just wanted to point out
> that you may not actually need to create a pointer for your specific needs
[quoted text clipped - 6 lines]
> object o3 = o2;
> MyClass class2 = o3;

What language are you using?  Neither C# nor C++ support implicit downcast.
Also "class" is a keyword in most languages and can't be used as a variable
name.

> After that sequence of events class, o1, o2, o3 & class2 will all be
> pointing at the exact same instance of MyClass object.
[quoted text clipped - 11 lines]
>>
>> Thanks.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.