Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Managed C++/CLI
  4. C++/CLI Beginner Questions

C++/CLI Beginner Questions

Scheduled Pinned Locked Moved Managed C++/CLI
c++questionlearning
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    TripShock
    wrote on last edited by
    #1

    ref class A
    {
    ...
    };

    int main()
    {
    A objA;

    return 0;
    }

    I thought we were not supposed to be able to use ref classes that way...only through tracking handles and tracking references. The above code compiles and runs. Could someone please explain it to me?

    L 1 Reply Last reply
    0
    • T TripShock

      ref class A
      {
      ...
      };

      int main()
      {
      A objA;

      return 0;
      }

      I thought we were not supposed to be able to use ref classes that way...only through tracking handles and tracking references. The above code compiles and runs. Could someone please explain it to me?

      L Offline
      L Offline
      led mike
      wrote on last edited by
      #2

      TripShock wrote:

      Could someone please explain it to me?

      They implemented stack semantics[^] in C++/CLI

      T 1 Reply Last reply
      0
      • L led mike

        TripShock wrote:

        Could someone please explain it to me?

        They implemented stack semantics[^] in C++/CLI

        T Offline
        T Offline
        TripShock
        wrote on last edited by
        #3

        Why is it that I can't do this:

        String yo;

        M L 2 Replies Last reply
        0
        • T TripShock

          Why is it that I can't do this:

          String yo;

          M Offline
          M Offline
          Mark Salsbery
          wrote on last edited by
          #4

          From the docs[^]: The following reference types are not available for use with stack semantics: *delegate *array (Visual C++) *String

          Mark Salsbery Microsoft MVP - Visual C++ :java:

          1 Reply Last reply
          0
          • T TripShock

            Why is it that I can't do this:

            String yo;

            L Offline
            L Offline
            led mike
            wrote on last edited by
            #5

            Welcome to CodeProject :beer:

            TripShock wrote:

            Why is it that I can't do this:

            Because you need to do this:

            String^ yo;

            That said, if you had spent like 10 minutes reading any of the tons of beginner material here on this site and all over the internet related to the CLI subject, you would already know that. 10 minutes rather than the 3 hours you have waited for an answer from an internet forum. 10 minutes or 3 hours, you decide.

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups