Skip to content

C++ Gurus

The forum for all discussions in C++ land.
1.3k Topics 8.5k Posts
  • 0 Votes
    13 Posts
    9k Views
    ?

    Thank you for the clarification.

  • [Moved] how to use pthread in qt??

    6
    0 Votes
    6 Posts
    5k Views
    G

    Moved to the C++ Gurus forum, this has nothing to do with Qt.

  • [moved]calling c application in Qt

    6
    0 Votes
    6 Posts
    3k Views
    G

    See the C++ FAQ "How to mix C and C++":http://www.parashift.com/c++-faq-lite/mixing-c-and-cpp.html and search the forums, the topic has been discussed several times. If you have a concrete problem, post some snippets. You cannot get more than a general answer for a general question...

  • 0 Votes
    19 Posts
    8k Views
    AlicemirrorA

    Me too I'm fighting with customer in these days. They have always great ideas :) Seems very experts in mobile development...

  • 0 Votes
    5 Posts
    3k Views
    G

    You have that List<B extends A> in C++ too, you can put all A subclass types into the list, but if you have B extending A you cannot assign a List<B> to a variable of type List<A>. Both are different cases.

    What you've tried does not work in Java either, the following snippet yields an error:

    @
    public InheritanceTest() {
    ArrayList<String> sl = new ArrayList<String>();
    String x = "abc";
    sl.add(x);

    ArrayList&lt;Object&gt; ol = new ArrayList&lt;Object&gt;(); Integer z = new Integer(1); ol.add(z); ol = sl;

    }

    // Error on the last line:
    // Type mismatch: cannot convert from ArrayList<String> to ArrayList<Object>
    @

  • [Moved] Document/View application

    20
    0 Votes
    20 Posts
    6k Views
    C

    Andre (and everyone else)-

    Thanks for your help. The first option compiled correctly. Having seen something that works I hope I can figure it out from here.

    Your last suggestion is appropriate. However, I have a large stack of books on C++ programming. The problem is the definition of the word "good". I learned chemical thermodynamics by using a large stack of textbooks. None of them were particulary good. But, where one authors explanation failed another author provided a more thorough explanation. I was able to piece it together that way. I haven't found that approach to work well for understanding C++.

  • 0 Votes
    1 Posts
    2k Views
    No one has replied
  • 0 Votes
    5 Posts
    3k Views
    S

    geniale (italian). thank you! =)

  • 0 Votes
    28 Posts
    24k Views
    A

    [quote author="mlong" date="1315319006"]The most sound advice I can give to you, Iama Hummingbird, is to go read code. (...)
    [/quote]
    Sound advice indeed.

  • 0 Votes
    6 Posts
    3k Views
    L

    I just want to add that if you create your object like this
    [quote author="Iama Hummingbird" date="1314911566"]
    @
    A::A():
    b(B()),
    c(C()),
    d(new D()){
    }
    @
    [/quote]
    you most probably will have to add a destructor which deletes the object d points to.

    If A a is deleted all the member variables are "deleted" automatically, this is b, c, and d*, but not the object d* is pointing to.

  • Looking for dd application as shared library

    9
    0 Votes
    9 Posts
    3k Views
    D

    The problem is that that QFile usage is a little "abuse" -- QFile is meant for random-access "ordinary" files, not sequential special files. Apart from that, you can just us it like that (possibly using QIODevice::Unbuffered), or since you can assume you're under unix, skip QFile and just use the low-level open(2) and read(2).

  • [solved]callback in Qt class

    3
    0 Votes
    3 Posts
    4k Views
    D

    Ok, It was so simple! Thanks

  • [Closed] Start at start up

    Locked
    4
    0 Votes
    4 Posts
    3k Views
    A

    please refer to the thread that Lukas mentions. Closing this topic.

    Next time: please search first, then post.

  • 0 Votes
    6 Posts
    10k Views
    F

    Good to see you fixed it. I do wonder why the context doesn't seem to be thread specific, though.

  • [SOLVED] Implementing C library in Qt GUI

    3
    0 Votes
    3 Posts
    7k Views
    G

    I've moved this to the C++ Gurus' forum, it's not Qt specific.

    Regarding the actual question, just follow the advice in the C++ FAQ on the link that EDIS already posted.

    Also have a look at "this older thread":http://developer.qt.nokia.com/forums/viewthread/8057 regarding the same topic.

  • Qt lib for fat32 io

    7
    0 Votes
    7 Posts
    4k Views
    Z

    Nice one!

  • [SOLVED] When Ampersand(&) is needed?

    12
    0 Votes
    12 Posts
    7k Views
    G

    Welcome.

    The point why I wrote that comment is, that a pointer can be invalid (which is typically 0), a reference should never be invalid. It should always reference a valid object.

  • 0 Votes
    7 Posts
    14k Views
    T

    thanks i will mark it as solved

  • 0 Votes
    3 Posts
    2k Views
    S

    D'oh - need more coffee.

    That worked!

    -thanks

  • 0 Votes
    25 Posts
    22k Views
    L

    [quote author="Giorgos Tsiapaliwkas" date="1313091362"]
    [quote author="Lukas Geyer" date="1313089715"]
    No, you never ever call delete on the object which is currently destructed.[/quote]

    if i have this ...[/quote]

    You are of course allowed to create and delete objects within a destructor - but you should never delete yourself (delete this). See mlong's post.