Would you be so kind and tell me what does ^ symbol mean in definition of object, example:

class ^Object

Thanks in adv

As you probably know, in C++ it is possible to overload the ^ operator to do whatever you want it to, though predefined it is the exclusive OR bitwise operator. I've never seen it used in the context of your post. In what context and with which language did you see this notation?

Would you be so kind and tell me what does ^ symbol mean in definition of object, example:

class ^Object

Thanks in adv

It doesn't mean anything that I can think of. Even if you look at C++/CLI where ^ is used for .NET reference types, it's still not used in a class definition, only an object definition.

Type^ obj;

At least tell me what is it called? 'top-level' operator? I would try to find something on it but I can't look for '^'. Just try to type it in google - it just doesnt work


This ^ must mean very much because compiler cannot convert "class^" to "class" type.
Please help

At least tell me what is it called? 'top-level' operator? I would try to find something on it but I can't look for '^'. Just try to type it in google - it just doesnt work

Google doesn't let you search on special characters. It's both a feature and a flaw in the algorithms they use. But it's also impossible to search for an operator that doesn't exist. Can you post some code that actually uses this thing? Some of your mates might just be pulling your leg. ;)

This ^ must mean very much because compiler cannot convert "class^" to "class" type.
Please help

Well, it doesn't mean anything. It's just a syntax error because C++ syntax doesn't allow a hat character at that location.

Google doesn't let you search on special characters. It's both a feature and a flaw in the algorithms they use. But it's also impossible to search for an operator that doesn't exist. Can you post some code that actually uses this thing? Some of your mates might just be pulling your leg. ;)

Well, it doesn't mean anything. It's just a syntax error because C++ syntax doesn't allow a hat character at that location.

Sample code:

System::String stringVariable;

in VC++ generates error:
error C3149: 'System::String' : cannot use this type here without a top-level '^'

System::String^ stringVariable;

and this code compiles without any errors

Sample code:

System::String stringVariable;

in VC++ generates error:
error C3149: 'System::String' : cannot use this type here without a top-level '^'

System::String^ stringVariable;

and this code compiles without any errors

I think I just misunderstood your first example. I read it as a class definition.

class ^MyClass {
  // ...
};

But you were talking about an object instantiation.

System::String^ myString;

I kind of guessed what you meant by mentioning C++/CLI object references, but it's a good idea to make sure that your example code isn't ambiguous. It makes answering questions easier if I don't have to guess what you meant. ;)

Cheers!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.