Qt - What do we mean by those code snippets

just have those questions about those code sinppets from the C++ GUI Programming with Qt 4 book:

GoToCellDialog::GoToCellDialog(QWidget *parent):QDialog(parent)

Does that mean we are inheriting QDialog(parent)? Or, what exactly does this mean?

setupUi(this);

Here, this code snippet is part of the gotocelldialog.cpp file, which is the implementation of gotocelldialog.h header file. What do we mean by this in this context? What are we trying to setup? And, what kind of setup will that be?

No, GoToCellDialog::GoToCellDialog(QWidget *parent):QDialog(parent) is a constructor. The : says that the stuff that follows is the initialisation list. It's a way of Initialising the members of a class when the constructor is called. To simplify:

The two member variables are set to the value of iNum for m_iNumber and true for the bool variable. Does that help at all?

I have that book too, it's a good one :o) You might also consider getting "Effective C++: 50 Specific Ways to Improve Your Programs and Designs" by Scott Meyers. He makes a good case for always initialising member variables this way if you can

No, GoToCellDialog::GoToCellDialog(QWidget *parent):QDialog(parent) is a constructor. The : says that the stuff that follows is the initialisation list. It's a way of Initialising the members of a class when the constructor is called. To simplify:

The two member variables are set to the value of iNum for m_iNumber and true for the bool variable. Does that help at all?

I have that book too, it's a good one :o) You might also consider getting "Effective C++: 50 Specific Ways to Improve Your Programs and Designs" by Scott Meyers. He makes a good case for always initialising member variables this way if you can

Thanks for your reply.

So, is:

A::A( int iNum ) : m_iNumber( iNum ), m_bFlag(true)
{
}

the same as:

A::A( int iNum )
{
m_iNumber = iNum;
m_bFlag = true;
}

?

And, how does this work for the case I asked about? In other words, how can we write it in the latter form?

Yes and No. For the simple case, the two are functionally equivalent. However, there are special cases where you can only use the initializer list to assign variables: base classes and const members.
In the base class scenario you do not actually have a handle to the class in question (there is no explicit this->parent or parent to assign to). This is not a problem if your base class constructor does not take arguments but if you need to pass arguments to the constructor the only place to do so is the initializer list.
In the const member scenario you would get an error about trying to assign to a const if you tried something like const_var = some_value; in the constructor body. You are, however, able to do klass() : const_var(some_value) {} .

Hi. so this is actually a continuation from another question of mine[Here](https://www.daniweb.com/programming/software-development/threads/506795/dynamically-add-values-into-datagridview-cell-from-listbox-vb2010) but i was advised to start a new thread as the original question …

I have a 2d matrix with dimension (3, n) called A, I want to calculate the normalization and cross product of two arrays (b,z) (see the code please) for each column (for the first column, then the second one and so on).
the function that I created to find the ...

Write a C program that should create a 10 element array of random integers (0 to 9). The program should total all of the numbers in the odd positions of the array and compare them with the total of the numbers in the even positions of the array and indicate ...