Remove the Const Attribute with a Cast : Cast « Data Type « Visual C++ .NET






Remove the Const Attribute with a Cast

 

#include "stdafx.h"
#using <mscorlib.dll>
using namespace System;
class MyClass
{
private:
    int t;
public:
    MyClass(int num) { t=num; }
    int get() const { return t; }
    void myFunc(){};
};
void main(void)
{
    const MyClass a(10);
    Console::WriteLine(a.get());
}

   
  








Related examples in the same category

1.Convert Data with C-Style Casts