cannot access private member



  • On 31/08/2017 at 02:17, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   R16 
    Platform:   Windows  ;   
    Language(s) :     C++  ;

    ---------
    I have a tag plugin with a sorted basearray and everything was ok, until I implemented CopyTo().
    Now I am getting "error C2248: 'maxon::SortedArray<MYSELF,ARRAY>::operator =' : cannot access private member declared in class 'maxon::SortedArray<MYSELF,ARRAY>' c:\program files\maxon\cinema 4d r16\plugins oggle visibility development\source oggle visibility.cpp 10 1 Toggle Visibility"

    What to do?
    I read other posts about this issue, but I did not see a solution.

    struct MySortedIntegerArray : public maxon::SortedArray<MySortedIntegerArray, maxon::BaseArray<Int> >
    {
    	// your sorted array must implement a LessThan() method
    	static inline maxon::Bool LessThan(Int a, Int b)	{ return a < b; }
    };
      
    class ToggleVisibilityC : public TagData
    {
      
      public:
    	MySortedIntegerArray switchFramesList;		//is automatically sorted.
    	Int32 switchFramesStartOnOff;
      
    	virtual Bool Init(GeListNode* node);
    	virtual EXECUTIONRESULT Execute(BaseTag* tag, BaseDocument* doc, BaseObject* op, BaseThread* bt, Int32 priority, EXECUTIONFLAGS flags);
    	virtual Bool GetDDescription(GeListNode* node, Description* description, DESCFLAGS_DESC& flags);
    	virtual Bool Message(GeListNode* node, Int32 type, void* data);
    	virtual Bool CopyTo(NodeData* dest, GeListNode* snode, GeListNode* dnode, COPYFLAGS flags, AliasTrans* trn);
      
    	....
    };
      
    Bool ToggleVisibilityC::CopyTo(NodeData* dest, GeListNode* snode, GeListNode* dnode, COPYFLAGS flags, AliasTrans* trn)
    {
    	((ToggleVisibilityC* )dest)->switchFramesList = switchFramesList;		// <== Error
    	((ToggleVisibilityC* )dest)->switchFramesStartOnOff = switchFramesStartOnOff;
    	return NodeData::CopyTo(dest, snode, dnode, flags, trn);
    	//return true;
    }
    


  • On 31/08/2017 at 13:26, xxxxxxxx wrote:

    ((ToggleVisibilityC* )dest)->switchFramesList.CopyFrom(switchFramesList);



  • On 31/08/2017 at 23:10, xxxxxxxx wrote:

    That works, thank you very much!

    -Pim



  • On 01/09/2017 at 08:07, xxxxxxxx wrote:

    Hello,

    the documentation includes the description of the BaseArray class (and its member functions like CopyFrom() ).

    best wishes,
    Sebastian


Log in to reply