Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3694684
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T04:31:34+00:00 2026-05-19T04:31:34+00:00

Any good site or explanation on what is a ref class and when to

  • 0

Any good site or explanation on what is a ref class and when to declare a class to be a "ref class"?

The explanation on msdn wasn’t enough for me,

base_type(optional)

A base type. A ref class or ref struct can inherit from zero or more managed interfaces and zero or one ref types. A value class or value struct can only inherit from zero or more managed interfaces.

ref

The ref keyword tells the compiler that the class or structure will be allocated on the heap and a reference to it will be passed to functions or stored in class members. The value keyword tells the compiler that all of the data in the class or structure is passed to functions or stored in members.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T04:31:35+00:00Added an answer on May 19, 2026 at 4:31 am

    Basically, a ref class is a CLR class. It’s the equivalent of class in C#.

    This creates a reference type managed by the CLR. If you want to make a class that’s usable from C#, you’d normally create a ref class. (ref struct, by the way, does exactly the same thing, but with C++’s standard class vs. struct default accessibility rules.)

    Also, just for reference – in order to make a value type (struct in C#), you’d use value class or value struct.

    A good explanation of many of these new keywords is Herb Sutter’s post on C++/CLI Keywords. This is a useful reference if you’re new to C++/CLI, but have a solid C++ background.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Anybody found yet a good web site architecture using linq to sql? Any help
Any good recommendations for a platform agnostic (i.e. Javascript) grid control/plugin that will accept
Any good suggestions? Input will be the name of a header file and output
Any good tutorial with source that will demonstrate how to develop neural network (step
Any GOOD libraries available to access SVN from .net application (using C#). The only
Any good logging libraries that support .NET compact framework?
Any good reason why $(p).html(0) makes all paragraphs empty as opposed to contain the
Any good converter for GB, Big5, Unicode? Convert GB to Unicode, Unicode to GB,
Any good libraries for quaternion calculations in C/C++ ? Side note: any good tutorials/examples?
Any good videos online on how to use Team Foundation Server as your Source

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.