6.1 Simple Properties

Simple Properties Exempel

#include <property.hpp>
#include <iostream.hpp>

#include <conio.h>

struct test_value
{
    int a;
    inline test_value() : a(3) {}
    inline test_value(int b) : a(b) { }
};
class test
{
public:
    std::propu8_t uint8_test;
    std::prop_t<test_value> test_getset;
};
int main(int argc, char** argv) {

    test g = test();
   
    g.uint8_test = 5;
    uint8_t t = (uint8_t)g.uint8_test; // t := 5
    g.uint8_test = (8); // g.uint8_test := 8
    
    test_value c = (test_value)g.test_getset; // c := 3
    g.test_getset = test_value(5); // g.test_getset := 5

    
    std::Console::writeline ( std::frmstring("t: %d g.uint8_test: %d", t, 
        (uint8_t)g.uint8_test) );
    std::Console::writeline ( std::frmstring("c: %d g.test_getset: %d", c.a, 
    (test_value)g.test_getset) );
    
    _getch();
    return 0;
}


Last edited Nov 29, 2016 at 12:55 PM by pbl1h0sc, version 2