* instead of ^?

Posted on 2006-03-28
Last Modified: 2010-04-24
Can I use * instead of ^ when I write managed code for .NET 1.1 and VC.Net 2003.

System::Net::IPAddress* localAddress_;

does not give me an error as long as I create my class as a __gc class.

System::Net::IPAddress^ localAddress_;

Won't work - though I'd prefer to use the second one with ^ instead of *.
Question by:bjqrn
    1 Comment
    LVL 48

    Accepted Solution

    In C++ 7.0 (2003) you must use * both for managed and unmanaged classes.
    In C++ 8.0 (2005) you need to use ^ for managed classes and * for unmanaged classes.

    __gc is C++ 7.1 keyword. In C++ 8.0 it is replaced with ref and value keywords, managed instances are allcated with gcnew instead of new.

    7.1    __gc        *   new
    8.0   ref value   ^   gcnew

    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    Join & Write a Comment

    The following diagram presents a diamond class hierarchy: As depicted, diamond inheritance denotes when two classes (e.g., CDerived1 and CDerived2), separately extending a common base class (e.g., CBase), are sub classed simultaneously by a fourt…
    In Easy String Encryption Using CryptoAPI in C++ ( I described how to encrypt text and recommended that the encrypted text be stored as a series of hexadecimal digits -- because cyphertext may…
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now