Mega Code Archive

 
Categories / Visual C++ .NET / Structure
 

Create a Structure Containing Functions

#include "stdafx.h" #using <mscorlib.dll> using namespace System; struct Point { private: int x; public:     void translate(int xx){x += xx;}     void setX(int xx){x = xx;}     int getX(){return x;} }; int main(void) {     Point point;     point.setX(10);     point.translate(10);     Console::Write("x = ");     Console::WriteLine(point.getX());     return 0; }