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 37 1 2 3 4

Search: Search took 0.04 seconds.

  1. Re: A question regarding throwing an exception

    Thanks for your reply. I think I understand it. So what happens in the code is that when "throw 2" is executed, then catch(...) will be called right away and then destroy all the automatic objects...
  2. Re: A question regarding throwing an exception

    I don't quite understand what you said. You said it only catches "throw 1" and then you said "causing the exception from throw 1 to be thrown and not caught". What does that mean? Thanks.
  3. Re: A question regarding throwing an exception

    But if I comment out “throw 2", "throw 1" can arrive in the catch(...) in the main. Only if I uncomment out "throw 2", "throw 1" never arrives in the catch(...). Why? Thanks.
  4. Re: A question regarding throwing an exception

    Basically if an exception is not caught, then the program will be terminated. The statement catch(...) will catch "throw 1" and "throw 2", right? So home come the program is still terminated. Thanks.
  5. A question regarding throwing an exception

    Here is the code,


    class A
    {
    public:
    ~A()
    {
    throw 1;
    }
  6. Why delegate can't be defined within a function?

    I found that whenever I tried to define a delegate within a function, there are compiler errors. Why? Thanks.
  7. Re: A question regarding passing a reference

    Thanks so much for your explanations. Actually this is what I understand. When we call foo(sb2), since sb2 is a reference and passed by value, so there are two copies of references, sb and sb2 and...
  8. Re: A question regarding passing a reference

    Thanks for your reply. But why sb = NULL in the function foo doesn't change sb2 in main to be NULL since sb is passed by reference?
  9. A question regarding passing a reference

    Here is the code,


    namespace test1
    {
    class Program
    {
    static void foo(StringBuilder sb)
    {
    sb.Append("test");
  10. Re: How to understand this simple piece of code?

    Yes, I did debug. Now I think I understand why. Within the function reverse, r does point to the middle of the string. But since r is passed by value, it won't change the address of r in main. r in...
  11. Re: How to understand this simple piece of code?

    The r in reverse points to the middle of the string but the r in main points to the beginning of the string. I don't understand why? Thanks.
  12. Re: How to understand this simple piece of code?

    Thanks for your reply. I agree that r in reverseStr points to the middle of the string. But how come the r in main points to the beginning of the string? That is really my question.
  13. How to understand this simple piece of code?

    Here is the code,


    void reverseStr(char* l, char* r)
    {
    char* p = l;
    char t;
    int len = 0;

    while(*p)
  14. Replies
    3
    Views
    38,036

    A question regarding multithreading

    What is the best way to make two threads do things alternatively? Thanks.
  15. 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();
    };
  16. Replies
    3
    Views
    196

    operator new without implementation?

    Here is the code,


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

    int main()
  17. 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;
  18. Is there any difference between static local variable and static global variable?

    Here is the code,


    class A
    {
    };

    A& CreateObject()
    {
    static A a;
  19. 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...
  20. 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...
  21. 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...
  22. Replies
    1
    Views
    633

    How to implement a circular buffer?

    What is the use of circular buffer? Thanks.
  23. 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.
  24. 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...
  25. What is the purpose to declare constructor as protected?

    Thanks.
Results 1 to 25 of 909
Page 1 of 37 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