Thanks for your time.
I have red your answer at least about 10 times, and I feel that I am close to understand the logic of the determined range in this do while expression.
I really appreciate all your pacient in this excellent explanation.
I think I need to read-up on "friend" - that semms to be the real OOP ticket
On the contrary: that might take you into a non-OOP design.
The idea of using public member functions is to make your code independent of internal implementation details of other classes. In your case, a class representing a rectangle might keep a corner of the rectangle and its dimensions. Another one might keep two opposite corners or some other combination. If you try to access private members of the class your code will need to change when or if the implementation of the rectangle changes. If you stick to using only public interface, the internal details of the rectangle class may change but your code will remain the same.
You cannot "buy" your way inside a class using a friend declaration. Just like in real life, the friendship is not a symmetrical relation. If you put a friend QRect declaration inside your class that doesn't give you any special access rights. It gives access rights to QRect to your class but obviously QRect is not going to use those rights. You would need to modify the QRect header file to insert a friend declaration mentioning your class. This is very intrusive and basically defeats the purpose of OOP design.
I cannot make an OOP design course here, but there are some pretty good references available.
One of the steps I invariably do, when debugging, is comment-out private blocks ... essentially rendering all statements public. Now that I get typing ... and that's just for starters.
Without the essential error code (warning?) accompanying a successful compilation/link/running blank form ... there's little more time expendable for me, especially if you're already running debugger and just don't care to get descriptive enough with words and include a code.
In the mean time I'll looking at usage of "friend".
Don't waste your time, since it will not make any difference. You cannot declare your class to be a friend of some other class in the hope of accessing its private variables. If that was possible then the millions of applications would be open to hacking. Do what I suggested above and make use of the information provided in the documentation: that is what it is there for..
It was serious, actually. If you the designer of the class made a member private then you have two ways to access it: the publicly exposed interface (for instance the get/set methods) or a dirty hack on its bare representation in memory. Typically you cannot use friend because you are not the designer of the class.
"In testa che avete, Signor di Ceprano?"
It looks like you're trying to create a pointer to whatever Run_DDD_OPTION returns. However, you also say
Run_DDD_OPTION(testWidget); // runs fine
which either means that it returns void or you didn't care what it returned. My guess is the former, which would explain all the error messages. If it returns void, you can't take its address, and there is no lvalue (=a memory address).
EDIT: If you want to pass the function Run_DDD_OPTION as an argument to addAction, just write
addAction(tr("&Device Discovery Dialog(modified Bluetooth scanner)"),
You may need the & in front of the function name--I haven't done this in a long time, so I have to look it up. --It looks like it's optional. If it doesn't work without it, try it with it.
I haven't used Qt, so I don't know if I can help. It sounds like a widget is an object, but you're only passing functions and parameters. Would passing an object help?
It's even possible to pass a class's member function[^] as a parameter. I've not used this capability, so you'd have to read up on it if that's what you want.
The problem with passing a function and its parameters is that different functions take different parameters. To deal with that, I think you'd need std::function[^]. Again, that's not something I've used, but now you can look for more details.
My go-to site for C++ is here[^]. It's a bit formal, so sometimes you need to look elsewhere for explanations and examples that are easier to understand. But it will provide you with the right terminology to use when investigating something.
Actually an interviewer asked me this question and told that class C contains the object of B class and through main C obj1(10,20) should be passed. Now you have to write constructor in all three class so that in main() function, it will not give an error.