-
I found the following sample coding from Qt documentation. Can you please explain the highlighted part? I am trying to understand the syntax for the argument: (const QModelIndex &/parent/). The /parent/ should be just comment, so the argument is just "const QModelIndex &"?
int DomModel::columnCount(const QModelIndex &/*parent*/) const { return 3; }
-
I found the following sample coding from Qt documentation. Can you please explain the highlighted part? I am trying to understand the syntax for the argument: (const QModelIndex &/parent/). The /parent/ should be just comment, so the argument is just "const QModelIndex &"?
int DomModel::columnCount(const QModelIndex &/*parent*/) const { return 3; }
-
@pdsc_dy
One thing about references that makes them different from pointers.
They cannot be nullvoid somefunc1( someting &var )
void somefunc2( someting * var)
somefunc1(NULL) ;// will give error
somefunc2(NULL) ;// accepted
@mrjj said:
They cannot be null
Sure they can:
int& bar = *(int*)nullptr;
- of course it's useless, dereferencing crashes the app and it generally makes no sense but there you have it - compiling just fine :) -
@mrjj said:
They cannot be null
Sure they can:
int& bar = *(int*)nullptr;
- of course it's useless, dereferencing crashes the app and it generally makes no sense but there you have it - compiling just fine :)@Chris-Kawa
Heh. Ok. Fair point. If you really want to. :) -
I found the following sample coding from Qt documentation. Can you please explain the highlighted part? I am trying to understand the syntax for the argument: (const QModelIndex &/parent/). The /parent/ should be just comment, so the argument is just "const QModelIndex &"?
int DomModel::columnCount(const QModelIndex &/*parent*/) const { return 3; }