What does it mean? Can you explain it in more details or make a simple example? many thanks
richardye
Posts
-
ask for a algorithm about visit array -
ask for a algorithm about visit arrayThere is a int array consists of 1001 elements. Inside it, only two element's values are equal. I mean that there are two items have the same value, and the other items are different. Design a algorithm according to the following commands: 1 every item of the array can only be visited once 2 find out the same value many thanks
-
How can I resize my CFrameWndThank you for your advise. If I call SetWindowPos, it indeed does work. However, I feel very strange about why WM_SIZE message doesn't do any effect. Won't it redraw the frame after I resize it?
-
How can I resize my CFrameWndI try to resize my CFrameWnd, but it doesn't work. Can anyone tell me the reason, thanks void CMyApp::OnAppAbout() { //here I want to resize and draw my framw window SendMessage(AfxGetMainWnd()->m_hWnd, WM_SIZE, SIZE_RESTORED, MAKELPARAM(50, 50)); AfxGetMainWnd()->ShowWindow(SW_SHOW); AfxGetMainWnd()->UpdateWindow(); }
-
the extended type name of COMHello, I am a beginner within the COM programming. After I have seen some simple examples of COM, I have a question about it. Could any one tell me when using COM within a VC project, after compile and link, is there any difference with other common VC projects? Many thanks
-
check constraintsIn oracle database there is a table t, its creat table sql is as follows: create table t ( sno number(3,0) check (sno >=1 and sno <=4) ); If another person want to know the context of the check constraint within table t, How to write this through SQL? thanks
-
oracle environment variable setting fileWell, may be you misunderstand my meanings. After the DBA installed the oracle software, he set these two variables. I think this information(ORACLE_HOME,ORACLE_SID) might be saved in a profile by the oracle process. And when I want to run the SQL*PLUS, I first read these information from this file, because the login user has changed, and the environment variable might be changed too. But I didn't know whether this file exist or not and its path. Do you have any idea about it? Many thanks
-
oracle environment variable setting fileI want to write a program to run SQL*PLUS on UNIX operating system. Before I run it, I should setting the system environment variables such as "ORACLE_HOME", "ORACLE_SID" first. But, I met with a question, I don't know from which profile I can get these information? Who can give me some suggestion? Many thanks.
-
How to get the text of create table sql when I know the table nameMy apologize. My meaning is to get it by command line,not by the ORACLE console. Do you have any way in resolving it?
-
How to get the text of create table sql when I know the table nameHow can I get the text of create table sql when I know the table name? Is there any view I can query for? for example I create a table T in oracle database. Can I get the text of its create table sql through oracle view? "create table T (sno number(3,0) primary key);" Many thanks.
-
Who can know the question of this programI define a class CArray2D,inside it I imeplement a "proxy" class CArray1D, so that if I create a object of CArray2D like CArray2D array(2,3), I can output the its element like cout<<array[0][0]. But when I run it, I met with serials of strange questions like error address. Can anyone tell me why? Many thanks The code is as follows class CArray2D { public: void Print() { CArray1D *pHead = pArray1D; for(int i=0; i<size2D; i++) { cout<<"[ "<<i<<" }"; pHead->Print1D(); pHead = pHead+i*sizeof(CArray1D); cout<<endl; } } CArray2D(int n2DWidth, int n1DWidth):size2D(n2DWidth) { pArray1D = new CArray1D[size2D]; }; ~CArray2D() { delete[] pArray1D; }; class CArray1D { public: CArray1D(int n1DWidth=3):size1D(n1DWidth) { pArray = new int[size1D]; for(int i=0; i<size1D; i++) { *(pArray+i*sizeof(int)) = 0; } }; ~CArray1D() { delete[] pArray; }; const int& operator[](int nIndex) const { return *(pArray+nIndex*sizeof(int)); } int& operator[](int nIndex) { return *(pArray+nIndex*sizeof(int)); } void Print1D() { for(int i=0; i<size1D; i++) { cout<<"["<<i<<"]="<<*(pArray+i*sizeof(int))<<" "; } } private: int size1D; int *pArray; }; const CArray1D& operator[](int nIndex) const { return *(pArray1D+nIndex*sizeof(CArray1D)); }; CArray1D& operator[](int nIndex) { return *(pArray1D+nIndex*sizeof(CArray1D)); }; public: int size2D; CArray1D *pArray1D; }; int main() { CArray2D array(2,3); array.Print(); array[0][0] = 3; array.Print(); cout<<array[0][0]<<endl; return 0; } } Tomorrow is another day
-
a link error about template and constructiontemplate class Counted { public: class TooManyObjects{}; static int getObjectNum() { return m_ObjectNum; }; protected: Counted(); Counted(const Counted& count); ~Counted() { --m_ObjectNum; }; private: static int m_ObjectNum; static const size_t m_MaxObjectNum; void init(); }; template Counted::Counted() { init(); } template Counted::Counted(const Counted& count) { init(); } template Counted::init() { if(m_ObjectNum > m_MaxObjectNum) { throw TooManyObjects(); } ++m_ObjectNum; } class Printer: private Counted { public: static Printer* makePrinter(); static Printer* makePrinter(const Printer& rhs); ~Printer(); void reset(); void performSelfTest(); using Counted::getObjectNum; using Counted::TooManyObjects; private: Printer(); Printer(const Printer& rhs); }; int Counted::m_ObjectNum = 0; const size_t Counted::m_MaxObjectNum = 5; Printer::Printer() { } Printer::Printer(const Printer &rhs) { } Printer::~Printer() { } Printer* Printer::makePrinter() { return new Printer(); } error LNK2019 unresolved symbol
-
a link error about template and constructiontemplate class Counted { public: class TooManyObjects{}; static int getObjectNum() { return m_ObjectNum; }; protected: Counted(); Counted(const Counted& count); ~Counted() { --m_ObjectNum; }; private: static int m_ObjectNum; static const size_t m_MaxObjectNum; void init(); }; template Counted::Counted() { init(); } template Counted::Counted(const Counted& count) { init(); } template Counted::init() { if(m_ObjectNum > m_MaxObjectNum) { throw TooManyObjects(); } ++m_ObjectNum; } class Printer: private Counted { public: static Printer* makePrinter(); static Printer* makePrinter(const Printer& rhs); ~Printer(); void reset(); void performSelfTest(); using Counted::getObjectNum; using Counted::TooManyObjects; private: Printer(); Printer(const Printer& rhs); }; int Counted::m_ObjectNum = 0; const size_t Counted::m_MaxObjectNum = 5; Printer::Printer() { } Printer::Printer(const Printer &rhs) { } Printer::~Printer() { } Printer* Printer::makePrinter() { return new Printer(); } when I compile it, an unresolved symbol "protected _thiscall":Counted:Counted(void)" are function "private: _thiscall Printer:Printer(void)" reference I don't know its meaning. How can I resolv it link error? Many thanks.
-
an link errorI write a program to count the number of objects. But when I compile it, I met with link errors. How can I resolve it? Head files: template class Counted { public: class TooManyObjects{}; static int getObjectNum() { return m_ObjectNum; }; protected: Counted(); Counted(const Counted& count); ~Counted() { --m_ObjectNum; }; private: static int m_ObjectNum; static const size_t m_MaxObjectNum; void init(); }; int Counted::m_ObjectNum = 0; const size_t Counted::m_MaxObjectNum = 5; class Printer: private Counted { public: static Printer* makePrinter(); static Printer* makePrinter(const Printer& rhs); ~Printer(); void reset(); void performSelfTest(); using Counted::getObjectNum; using Counted::TooManyObjects; private: Printer(); Printer(const Printer& rhs); }; in definition file: template Counted::Counted() { init(); } template Counted::Counted(const Counted& count) { init(); } template Counted::init() { if(m_ObjectNum > m_MaxObjectNum) { throw TooManyObjects(); } ++m_ObjectNum; } Printer::Printer(){} Printer::Printer(const Printer &rhs) {} Printer::~Printer() {} Printer* Printer::makePrinter() { return new Printer(); } Printer* Printer::makePrinter(const Printer& rhs) { return new Printer(rhs); } error LNK2001 private static int Counted::m_ObjectNum"XXX" is unresloved error LNK2019 protected: _thiscall Counted::Counted(void) "private _thiscall Printer::Printer(void)" why? Does the static memeber of a class can only be initialized by its base class. How about its derived class? Many thanks
-
Problem with Including new project's header fileAs you have explained above, you mean you have included the head file "omnithread.h" correctly. May be you haven't defined the preprocess macro such as "__SINIX__", "__osr5__", "__irix__", so error "No implementation header file" occurs. Tommorrow is another day.
-
Problem with Including new project's header fileFirst, check the position of that header file, I suggest you use full path in your include sentence. If it doesn't work. In Microsoft Visual Visual Stdio .Net, choose [TOOL]->[OPTION]->[PROJECT]->[VC++ DIRECTORY]->[INCLUDE FILE], select the header file you want to include, then rebuild your whole project. Sometimes, you have to close the VC, and then open it. Tomorrow it another day.
-
a pointer questionthank you.
-
a pointer questionPoint foobar() { Point local; Point *heap = new Point; *heap = local; // ... stuff ... delete heap; return local; } There is a question on the source above. Since point heap points to the object 'local', there is no need to new the point 'local' If I change 'Point * heap = new Point' to 'Point * heap', Isn't the source more effective? Another question is that if the class Point hasn't define the destructor function, We know that the compiler will define the default destructor function itself. But if I delete heap, will the call of default destructor be called? Many thanks. Tomorrow is another day.
-
virtual functionInside <>, it wrote "It is stll a bad design choice to declare all functions virutal and to depend on the compiler to optimize away unnecessary virtual invocations." I can't understand it very well. class Abstract_base { public: virtual ~Abstract_base()=0; virtual void interface1() const = 0; virtual const char* mumble() const {return _mumble;) protected: char *_mumble; }; As the source above. "virtual const char* mumble() const {return _mumble;)" If you define a member function to be virtual, you insert a vptr in your class object. but as the function's defination has been claimed within the head file, it must be looked as an linline function. Is it right? Tomorrow is another day!
-
virtual functionInside <>, it wrote "It is stll a bad design choice to declare all functions virutal and to depend on the compiler to optimize away unnecessary virtual invocations." I can't understand it very well.