Fl_Widget have next constructor:
Fl_Widget (int x, int y, int w, int h, const char *label=0L)
How can i send char* instead const char*? I just want use my char Tmp[255] variable in constructor.
Fl_Widget have next constructor:
Fl_Widget (int x, int y, int w, int h, const char *label=0L)
How can i send char* instead const char*? I just want use my char Tmp[255] variable in constructor.
C++ allows the implicit casting of a T*
to a const T*
for any type T
so in your case you can just pass the parameter to the function.
Also, if you own the Fl_Widget
constructor, then you should change the default value for label
from 0L
to nullptr
, or 0
if using C++03 or earlier.
(To convert from const T*
to T*
requires a const_cast
and can lead to undefined behaviour).
If your ctor currently looks like this, where foo
is your class:
foo::foo() : FL_Widget(13, 13, 13, 13, Tmp){
char Tmp[255]{"blah blah blah"};
}
That's not legal. You cannot pass a parameter to a parent ctor that happens in your class's ctor, this is because the parent ctor happens before your class ctor is called.
You could instead do this: foo::foo() : FL_Widget(13, 13, 13, 13, "blah blah blah"){}