Re: How can I use CArray efficiently?
Maybe GetCount
came first, and then they added SetSize and felt there needed to be a
corresponding GetSize, but couldn't remove GetCount since it was already
in
use. These things happen.
Perhaps templates methods can't be overloaded,
but with other implementations of the templates,
such as in CListBox, CListCtrl, etc.
It is meant to be implemented or added in the hopes
that there is some kind of congruence within the language.
CListBox has GetCount. Size = Count, so there was no
need to add GetSize. Understandable and congruent.
CListCtrl changes GetCount to GetItemCount.
Joe inadvertantly made a mistake in his menu reply.
for(int i = 0; i < menu->GetCount(); i++)
It should be GetMenuItemCount()
It makes the language incongruent.
I get confused on what I say sometimes.
Start, Finish or Begin, End?
Start, End, or Begin, Finish?
IsOn()? GetOn()?
IsEnabled() GetEnabled()?
I do GetStateEnable() now.
I add State for all bool conditions.
It is too confusing otherwise.
GetMyObject()->Dang_What_Did_I_Call_It?
I changed it to Implementation, rather than inheritance.
Since template methods can't be overloaded.
class CMyArray
{
private:
CArray<Object, Object> m_Array;
int m_nCount;
public:
int GetSize();
int GetCount();
}
CMyArray::GetSize()
{
return m_Array.GetSize();
}
CMyArray::GetCount()
{
return m_nCount;
// return m_Array.GetCount();
}
//Added Incongruence
CMyArray::GetMyArrayItemCount()
{
}