Essential COM

++

, , . C++ , (encapsulation), . , , , FastString , : . O(1)- FastString, . , FastString::Find , . Length , FastString::Length strlen . O(n)- (null terminator); . , Length, , , Length, . . , , , Length. , , , , FastString, .

FastString , , . , FastString , (data members) (private). , FastString. , (public) , . , FastString 2.0.

: (constructor) Length. , , . , . :

 // faststring.h version 2.0  class _declspec(dllexport) FastString {      const int m_cch;       // count of characters        //          char m_psz;   public:      FastString(const char *psz);     ~FastString(void);      int Length(void) const;       // returns # of characters        //            int Find(const char *psz) const;        // returns offset -      };  

, . , :

 FastString::FastString(const char *psz)     : m_cch(strlen(psz)), m_psz(new char[m_cch + 1])  {      strcpy(m_psz, psz); } 

Length :

 int FastString::Length(void) const  {      return m_cch;        // return cached length        //        }  

, DLL FastString , FastString. , , , . . DLL , FastString 2.0 , , .

, , FastString, DLL FastString. , : , Length, . , DLL " " CD, . , - DLL. , ( ) FastString DLL, . , , 2.0 FastString , .

: - . , . , - , , DLL FastString. . , . , . , , , . ?

 . 1.3. c++

, , C++ . C++ , C++ . , C++ , , . . , . 1.3. 1.0 FastString ( sizeof(char *) == 4). 1.0 . , 2.0 ( DLL ) , ( sizeof(int) == 8), . , 1.0 - , , .

DLL , . Microsoft Foundation Classes (MFC). DLL ( , FastString10.DLL, FastString20.DLL), DLL, , . , , - , DLL, , . , , .

, C++, . , C++ . C++, . , . , , C++ DLL .



Suschnost' tehnologii SOM
Essential COM
ISBN: 0201634465
EAN: 2147483647
Year: N/A
Pages: 103
Authors: Don Box

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net