Mega Code Archive

 
Categories / Visual C++ .NET / Class
 

Class with setter and getter

#include "stdafx.h" class MyClass {    private:       double pos[3];       unsigned int a;       unsigned int b;    public:        MyClass() : a(1), b(1)        {            pos[0] = 0; pos[1] = 0; pos[2] = 0;        }        MyClass(double x, double y, double z, unsigned int a, unsigned int n): a(a), b(n)        {           pos[0] = x; pos[1] = y; pos[2] = z;        }        unsigned int GetA() {            return a;         }        void SetA(unsigned int a) {            a = a;         }        unsigned int GetB() {            return b;         }        void SetB(unsigned int n) {            b = n;         }        double GetPosition(int index) {            return pos[index];         }        void SetPosition(int index, double value) {            pos[index] = value;         } };