Search:

Type: Posts; User: UMR_Student

Page 1 of 4 1 2 3 4

Search: Search took 0.01 seconds.

  1. A singleton is a class of which there can and...

    A singleton is a class of which there can and should only be one instance at any given time. If you're wanting to copy the object, then you shouldn't be using the singleton pattern in the first...
  2. Replies
    22
    Views
    3,582

    Is std::list not good enough?

    Is std::list<> not good enough?
  3. Replies
    17
    Views
    2,306

    > For all intents and purposes, a static member...

    > For all intents and purposes, a static member of a class *IS* a global variable.


    class foo
    {
    public:
    static int* getInstance();
    private:
    static int* m_instance;
    };
  4. Replies
    12
    Views
    9,777

    You might also want to check out the Qt toolkit,...

    You might also want to check out the Qt toolkit, and Qt's Designer form layout tool.
  5. Replies
    28
    Views
    3,082

    Yeah, I totally read that wrong. Sorry.

    Yeah, I totally read that wrong. Sorry.
  6. Replies
    28
    Views
    3,082

    > References cannot change the object they refer...

    > References cannot change the object they refer to.

    Oh no? Then explain the output of this program...



    #include <iostream>

    void foo(int& bar)
    {
  7. Replies
    38
    Views
    9,181

    This may be a little off-topic on a C++ forum,...

    This may be a little off-topic on a C++ forum, but just at a first glance, this really sounds like a job for Stackless Python.
  8. Replies
    17
    Views
    2,306

    Well, I can't see much reason for having more...

    Well, I can't see much reason for having more than one instance for such a class (although maybe someone else can), so, yes, I would implement it as a singleton.
  9. > It would be even more overhead doing it...

    > It would be even more overhead doing it himself...

    Awww, you ruined it. I was just going to let the obvious conclusion go unsaid.
  10. Taken from...

    Taken from http://www.boost.org/libs/serialization/doc/tutorial.html:

    "The serialization library contains code for serialization of all STL classes."

    The question then becomes, is the...
  11. Replies
    10
    Views
    2,816

    Sounds like you're having a blast at work :) ...

    Sounds like you're having a blast at work :)

    Yeah, and I completely understand your point of view there. It's just a matter of personal preference.



    Maybe I'm missing something, but I'm a...
  12. Replies
    10
    Views
    2,816

    > The nodes of a linked list are an excellent...

    > The nodes of a linked list are an excellent example.

    They're a viable one. I, however, would rather not abstract them, especially if the node type could be useful in other contexts (maybe a...
  13. int main() { MyClass* myObject; ...

    int main()
    {
    MyClass* myObject;

    function1(myObject);
    function2(myObject);

    return 0;
    }
  14. Replies
    10
    Views
    2,816

    > If a struct or class only makes sense in the...

    > If a struct or class only makes sense in the context of another, it makes all the sense in the > world to make it nested.

    Maybe you could give me an example of one such relationship?
  15. Replies
    10
    Views
    2,816

    > but it would seem logical that struct Point...

    > but it would seem logical that struct Point should be inside the linkedPointList class,

    It would?

    I am of the opinion that there is absolutely no reason to nest structures inside of classes....
  16. Replies
    7
    Views
    6,017

    There are two things you need to familiarize...

    There are two things you need to familiarize yourself with:
    #1. Arrays (as MacGyver suggested)
    #2. The TAB key

    After you you've learned about these, here's a random nitpick for you:


    int...
  17. read(file, (char*)data2, sizeof(data2)); ...

    read(file, (char*)data2, sizeof(data2));

    //Should be this
    read(file, static_cast<char*>(&data2), sizeof data2);
  18. Replies
    12
    Views
    6,587

    The fastest I/O stuff is pretty much always...

    The fastest I/O stuff is pretty much always OS-specific. For example, write() on Unix-based systems.
  19. One of my projects right now is an AOL instant...

    One of my projects right now is an AOL instant messenger bot. Lots of network programming because I'm creating my own implementation of the protocol, and some good AI stuff. Just food for thought
  20. Replies
    6
    Views
    1,728

    In addition to what Desolation said (I ditto all...

    In addition to what Desolation said (I ditto all of that), just at a glance it looks like your functions are doing too much. Divide and ye shall conquer.

    >Well thats the way i've been taught.
    ...
  21. Replies
    5
    Views
    1,662

    Gotcha, but is there any reason in particular why...

    Gotcha, but is there any reason in particular why the struct has to be defined inside the class?
  22. Replies
    5
    Views
    1,662

    class foo { int bar(); }; int foo::bar()...

    class foo
    {
    int bar();
    };

    int foo::bar()
    {
    return 0;
    }
  23. Replies
    5
    Views
    1,838

    > ...can anyone point out my mistake? Yes....

    > ...can anyone point out my mistake?

    Yes. You're writing a queue in C++.

    You've forgotten to set the pointer that you've just free'd (BTW, use new/delete) to NULL, so the function deletes it,...
  24. Replies
    8
    Views
    4,125

    No offense, but that code is kinda funny. You...

    No offense, but that code is kinda funny. You have this nice polymorphic hierarchy going, and then you get to the main function and it's like you've never even heard of a for loop.

    Teasing aside,...
  25. Replies
    3
    Views
    2,840

    #include #include #include...

    #include <iostream>
    #include <cstdlib>
    #include <ctime>

    using namespace std;

    int roll_die();
    void display( int [] );

    //This is kind of stupid, but whatever
Results 1 to 25 of 88
Page 1 of 4 1 2 3 4