Search Results - CodeGuru Forums
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com

Search:

Type: Posts; User: LarryChen

Page 1 of 36 1 2 3 4

Search: Search took 0.03 seconds; generated 9 minute(s) ago.

  1. Replies
    3
    Views
    35,737

    A question regarding multithreading

    What is the best way to make two threads do things alternatively? Thanks.
  2. Re: Is there any difference between static local variable and static global variable

    This is going to be interesting. Here is the code,


    class A
    {
    private:
    A(){}
    friend A& CreateObject();
    };
  3. Replies
    3
    Views
    182

    operator new without implementation?

    Here is the code,


    class A
    {
    private:
    void* operator new(size_t size);
    };

    int main()
  4. Re: Is there any difference between static local variable and static global variable

    Thanks for your reply. Here is the code,


    class A
    {
    };

    A& CreateObject()
    {
    static A a;
  5. Is there any difference between static local variable and static global variable?

    Here is the code,


    class A
    {
    };

    A& CreateObject()
    {
    static A a;
  6. Re: What is the purpose to declare constructor as protected?

    Ok, may I ask a related question here? We can define a singleton by defining its constructor protected. Therefore the singleton class can be derived from. Then what is the benefit to allow a...
  7. Re: What is the purpose to declare constructor as protected?

    Are you saying a class with a protected constructor serves as an abstract class? Think about a singleton class with a protected constructor. You can still call a static member function to create an...
  8. Re: What is the purpose to declare constructor as protected?

    Thanks for the recommendations. But it seems nobody answered my question, that is, a class with a protected constructor can be derived from, but what is the use to derive from such a class? In other...
  9. Replies
    1
    Views
    582

    How to implement a circular buffer?

    What is the use of circular buffer? Thanks.
  10. Re: What is the purpose to declare constructor as protected?

    I understand a class with a protected constructor can be derived from. But my question is what is the use to derive from such a class? Thanks.
  11. Re: What is the purpose to declare constructor as protected?

    Thanks for the link. Let's compare two cases that making constructor protected or making constructor private. They both don't allow users to instantiate the object of the class directly. The...
  12. What is the purpose to declare constructor as protected?

    Thanks.
  13. Replies
    2
    Views
    165

    Why there is not any compiler errors?

    Here is code,


    void foo(int x);
    void foo(int x);

    int main()
    {
    return 0;
    }
  14. Replies
    2
    Views
    175

    Re: A question regarding stl sort with list

    Thanks for your explanation!
  15. Is there any difference between these two statements?

    Here is the code,


    class A
    {
    public:
    A()
    {
    cout<<"A::A()"<<endl;
    }
  16. Replies
    2
    Views
    175

    A question regarding stl sort with list

    When I call stl sort with a vector in the following,


    int main()
    {
    vector<int> items;
    sort(items.begin(), items.end(), greater<int>());

    return 0;
    }
  17. Is there any way other than CRecordset to read/write database in VC++?

    Thanks.
  18. Replies
    8
    Views
    630

    virtual breaks encapsulation in C++?

    Here is the code,


    class A
    {
    public:
    virtual void foo(){}
    };

    class B : public A
  19. Replies
    12
    Views
    644

    Re: A question regarding const

    What I don't understand is first example. The function foo expects const char*, but the passed argument is of type char*. Even though the argument passed to foo is a copy but the copy is still of...
  20. Replies
    12
    Views
    644

    Re: A question regarding const

    I am not concerned about whether s in main is going to be modified or not. I am only concerned about why there is compiler errors in second example? Why would you always bring these two irrelevant...
  21. Replies
    12
    Views
    644

    Re: A question regarding const

    I don't quite understand your logic. Based on the same reasoning, in the first example, I am trying to pass const char*, but s in main is not a const char*, so the compiler is bellyaching but...
  22. Replies
    12
    Views
    644

    Re: A question regarding const

    I am using visual C++ 2010 express.
  23. Replies
    12
    Views
    644

    A question regarding const

    Here is the code,


    void foo(const char* s)
    {
    s = "mary";
    }

    int main()
    {
  24. Replies
    17
    Views
    850

    Re: A question regarding float and double

    Thanks so much for responding. But I am just wondering if there is any reliable way to decide the position of point in a float or a double without converting it to a string?
  25. Replies
    17
    Views
    850

    A question regarding float and double

    Suppose we want to decide the position of point in a float or a double, here is what I do,


    float d;
    int count = 0;

    while(d!=(int)d)
    {
    d *= 10;
    count++;
Results 1 to 25 of 896
Page 1 of 36 1 2 3 4


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center