New answers tagged

0

Your doing what is called 'downcasting'. You can do this in C++, however, it's not recommended (imho) because of the various baggage that C++ has that Java doesn't. Direct downcasting (like the example above) will 'slice' off derived data when cast to the base class. To avoid this, you need to use pointers. RTTI. This is a feature where you can determine ...


0

... copy the content of raw into m_rawData or it will copy the actual reference of the raw and m_rawData will become invalid when the otherClass::someOtherMethod returns? this->m_rawData =raw; will likely trigger the copy assignment operator on QByteArray. This is because you didn't initialize m_rawData in the initializer block and you therefore ...


3

Under the hood, it might be implemented differently, but the visible effect of MyClass(const QByteArray & raw){ this->m_rawData =raw; } will be that the contents of raw get copied into m_rawData and will survive after raw has been destructed. This works because m_rawData is declared as being a value of type QByteArray. If it would have ...


2

Have I not created a variable MyList of size double? With double[] MyList;, you've merely created a variable that can later refer to an array of doubles. You haven't created any doubles. It's essentially a pointer. Why is there an option of declaring an array, instead of creating it at once? Sometimes you won't want to create it at once. For example, ...



Top 50 recent answers are included