constant member function in Managed C++
-
Hi to all, How to write a constant member function in Managed C++ class.
public ref class CMyClass { public : void Function(void) const { } }
Here I got error as, error C3842: 'Function': 'const' and 'volatile' qualifiers on member functions of managed types are not supported - Aniket A. Salunkhe
-
Hi to all, How to write a constant member function in Managed C++ class.
public ref class CMyClass { public : void Function(void) const { } }
Here I got error as, error C3842: 'Function': 'const' and 'volatile' qualifiers on member functions of managed types are not supported - Aniket A. Salunkhe
[^]. :)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke -
Hi to all, How to write a constant member function in Managed C++ class.
public ref class CMyClass { public : void Function(void) const { } }
Here I got error as, error C3842: 'Function': 'const' and 'volatile' qualifiers on member functions of managed types are not supported - Aniket A. Salunkhe
Hi, Please try this technique,
public ref class CMyClass
{
public:
void Function(void) const;
};void CMyCLass::Function() const
{
.
. // Code definition
.
}Wish you Good Luck...:rose:
Jagdish Bhimbha S/W Developer
-
Hi to all, How to write a constant member function in Managed C++ class.
public ref class CMyClass { public : void Function(void) const { } }
Here I got error as, error C3842: 'Function': 'const' and 'volatile' qualifiers on member functions of managed types are not supported - Aniket A. Salunkhe
Aniket Salunkhe wrote:
error C3842: 'Function': 'const' and 'volatile' qualifiers on member functions of managed types are not supported
See here.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
-
Hi to all, How to write a constant member function in Managed C++ class.
public ref class CMyClass { public : void Function(void) const { } }
Here I got error as, error C3842: 'Function': 'const' and 'volatile' qualifiers on member functions of managed types are not supported - Aniket A. Salunkhe
The error message pretty much says it all. I can't understand why you felt the need to post the question.
Steve
-
The error message pretty much says it all. I can't understand why you felt the need to post the question.
Steve
I think there is a wider question here - are we saying that the .net languages do not support const correctness at all, or is the syntax just different? Unless you didn't guess I am from a C++ background! For instance if I have a const handle to an object, how do I restrict the caller to only calling certain functions - for instance getters which do not modify the object and not setters which would cause the object to be modified?