none
Using a value struct as a property of another class RRS feed

  • Frage

  • Hi there,

    I'm quit new to C++/CLI. I wrote a value struct including several values. I want to use an instance of that class as a data member of another class, a property to be more precisely. That works just fine, but I somehow can't assign values to the struct's members. The compiler always gives me Error C2106: left operand must be l-value. Code as follows:

    namespace name{
    
    	public value struct B sealed
    	{
    		int member;
    	};
    
    	public ref class N sealed
    	{
    
    	public:
    
    		property B b;
    
    		N()
    		{
    			b.member = 0;		//C2106
    		}
    	};
    
    }

    Donnerstag, 25. Dezember 2014 13:44

Antworten

Alle Antworten