Menu
Menu
DaniWeb
Log In
Sign Up
Read
Contribute
Meet
Search
Search
About 1,000 results for
const
- Page 1
Re: how to create a simple elevator simulation?
Programming
Software Development
1 Week Ago
by trueframe
To make a basic elevator simulation, first, identify the floors and the elevator's capacity. Then, use loops and conditionals in programming to mimic its movement. Include buttons for users to call the elevator and select floors. Test thoroughly for accuracy.
GCC Fails to Recognize Parameters
Programming
2 Months Ago
by snah19
…quot; /** @name Logging context. */ /*@{*/ static
const
char *urlcontext_to_name(void *ptr) { URLContext *h … }, 0, INT64_MAX, AV_OPT_FLAG_ENCODING_PARAM | AV_OPT_FLAG_DECODING_PARAM }, { NULL } };
const
AVClass ffurl_context_class = { // L64:15 .class_name = "URLContext…
Re: Seeking Help for Creating a Circle Generator Tool
Programming
Game Development
2 Months Ago
by jackwells
…: 50%; background-color: lightblue; } function generateCircle() {
const
radius = document.getElementById('radius').value;
const
diameter = radius * 2;
const
circle = document.getElementById('circle'); circle.style…
Re: How can I create a meme generator using js canvas?
Programming
Web Development
2 Months Ago
by jessicaboland
… rather than using an overlay div. See Example:
const
canvas = document.getElementById('yourCanvasId');
const
ctx = canvas.getContext('2d'); // User input and rendering…
const
userInput = 'Your Text Here'; ctx.fillText(userInput, x, y); // Initial …
Re: GCC Fails to Recognize Parameters
Programming
2 Months Ago
by Reverend Jim
I can't offer any suggestions other than to just download the compiled app for your system instead of building it yourself.
Re: GCC Fails to Recognize Parameters
Programming
2 Months Ago
by rproffitt
Here's another problem. When we change the OS not only must we setup the compiler, environment and such but sometimes an OS API could be deprecated or removed. You made mention of a possible OS change so that's a possibility. You obtained this code from somewhere. Go back there and see if they updated it for your new OS.
Re: GCC Fails to Recognize Parameters
Programming
1 Month Ago
by toneewa
While I haven't used DJGPP for a couple decades, I decided to install the ffmpeg library and do a test program another way. For me, the declarations worked changing: #include "os_support.h" #include "avformat.h" #include "internal.h" #if CONFIG_NETWORK #include "network.h" #…
Re: Const and iterators
Programming
Software Development
13 Years Ago
by gerard4143
Const
iterators are used to indicated that the underlying object data members will not change.
Re: const
Programming
Software Development
13 Years Ago
by mike_2000_17
… int hour; int minute; public: int getHour()
const
; //
const
means that reading the value of hour does not change…lt;< value.getTime(); //however, calling the non-
const
method will not be allowed: out << value…situations. However, many beginners mistakenly think that
const
-correctness is restrictive and annoying, but that is…
Re: const
Programming
Software Development
13 Years Ago
by mike_2000_17
… class and only look at the interface (including the
const
qualifiers which are an integral part of the interface of…data should it output or modify (and that's where
const
comes in). After, the implementation can begin and your … is. It simply makes a data member immune to the
const
qualifier, like this: [CODE] class Foo { private: mutable int…
const
Programming
Software Development
13 Years Ago
by smcguffee
… that prompted my questions: "Accessors should be
const
methods at the very least, because the object state…cv-qualifiers errors that I had because of a
const
that was introduced through netbeans automatically generating getter functions… above, as was automatically done for me, that
const
is something that should be used. Does anyone have…
Re: const
Programming
Software Development
13 Years Ago
by Fbody
…architecture" is both safe and fast. You use
const
several different ways under different circumstances to produce [B]…want to make it safe, you use a
const
reference. A
const
reference is declared just like a reference except …you add
const
to the declaration. Adding
const
tells the compiler that you are passing…
Re: const
Programming
Software Development
13 Years Ago
by smcguffee
… bit hesitant. Suppose I write a class that has a
const
variable parameter in a method function. Then suppose the class… of work and extra man hours to undo all the
const
'ing that had been incorporated throughout all of the algorithms… would not have expected when I start writing code. Would
const
'ing still be recommended even if such a case might…
Re: const
Programming
Software Development
13 Years Ago
by smcguffee
… variables. Thus, even though Net Beans defaulted to putting a
const
in a getter function for me, and there is a… place for
const
types; the place for
const
is not in classes that are intended for… all variables, even inside getter functions. On the other hand,
const
is best used in classes where the function of the…
Re: const
Programming
Software Development
13 Years Ago
by Fbody
… to simply call object.sortList() (which by nature is non-
const
and I suspect you already have) then call object.getList…() (which would be
const
and I suspect you also may already have)?
Re: const
Programming
Software Development
13 Years Ago
by Fbody
It is appropriate to have
const
getters, you just need to call them properly. A getter method should rarely do more than simply return some value. If there are some calculations that require temporary values, then those temporary values should be stored in local variables rather than in member variables.
Re: const
Programming
Software Development
13 Years Ago
by smcguffee
Good call--I like that point--there should be a
const
getter called inside any getter. I'll have to start doing that because it will definitely help keep me more organized.
Const methods to read private data members of a class
Programming
Software Development
9 Years Ago
by JayGarxP
…true if found bool Player::Search(
const
char * playa)
const
{ bool foundPlayer = false;… char* GetName()
const
; int GetGrade()
const
; double GetGPA()
const
; bool Search(
const
char*)
const
; void Display()
const
; //Keeps track of…
Const Question - Why is this happening?
Programming
Software Development
15 Years Ago
by VernonDozier
…passed to a copy constructor, and the word [ICODE]
const
[/ICODE] on line 40: [code=cplusplus] #include…MyClass& f) { cout << "In non-
const
copy constructor pre-mutation: f.x = " <<….x = 8; cout << "In non-
const
copy constructor post-mutation: f.x = " <…
Re: Const Question - Why is this happening?
Programming
Software Development
15 Years Ago
by Sci@phy
…but it's irrelevant) will not change! But, that
const
keyword is irrelevant of calling constructor. When you write: …[CODE=cplusplus]MyClass (
const
MyClass& f)[/CODE] You say to compiler: This… constructor is going to GET object of type:
const
MyClass! When you write inside a main function: […
Re: Const Question - Why is this happening?
Programming
Software Development
15 Years Ago
by VernonDozier
… if "some_other_MyClass_obj" is of type
const
MyClass or simply MyClass, and then calls proper…write your copy constructor as such: [code] public MyClass (
const
MyClass& f) { // code } [/code] and… like?" I think I answered: [code] public MyClass (
const
MyClass& f) { // code } [/code] as opposed…
Re: Const Question - Why is this happening?
Programming
Software Development
15 Years Ago
by vijayan121
…// overload resolves to exact match : MyClass::MyClass( MyClass& )
const
MyClass& g = f ; Func (g); // make copy of… g is not a modifiable lvalue // call MyClass::MyClass(
const
MyClass& ) to make the copy }[/code] the copy… constructor that takes a non-
const
object as argument is used to make copies of …
Const passing problem
Programming
Software Development
11 Years Ago
by Psyho
…{ public: DirectionSequence(); void push_back(
const
D ad); void change_direction();
const
D at(
const
int vp); int size(); private…."; } template <class T>
const
D at(
const
int vp) { return (v[vp]); } …
Re: Const Question - Why is this happening?
Programming
Software Development
15 Years Ago
by VernonDozier
…my non-member function to this: [code] void MyClass Func (
const
MyClass f) { f.x = 10; f.DoSomething (f…it IS changed when the function calls the non-
const
copy constructor. [code] MyClass ([COLOR="Red… f[/COLOR]) { cout << "In non-
const
copy constructor pre-mutation: f.x = " <…
Re: Const Question - Why is this happening?
Programming
Software Development
15 Years Ago
by Sci@phy
…: [CODE=cplusplus] void MyClass Func (
const
MyClass f) //or even simply:
const
MyClass f(some_MyClass_obj); [/CODE] And let… checking if "some_other_MyClass_obj" is of type
const
MyClass or simply MyClass, and then calls proper constructor… function. He doesn't care about line "
const
MyClass f", because after the "f&…
Re: Const Question - Why is this happening?
Programming
Software Development
15 Years Ago
by ArkM
…] A compiler-generated (default) copy constructor always has
const
X& parameter. Some careful compilers print warnings if… binding). So it's possible to modify a non-
const
only ARGUMENT object (initializer) via X& copy…: [code=cplusplus] void F(X x) { ... } void F(
const
X x) { ... } [/code] All static member functions are ordinar…
const char* and char* problem
Programming
Software Development
13 Years Ago
by chamika.deshan
…saying. [QUOTE]Error 1 error C2664: '
const
char *TiXmlElement::Attribute(
const
char *)
const
' : cannot convert parameter 1 from '… element->Attribute definition [CODE]
const
char* Attribute(
const
char* name )
const
;[/CODE] But it gives me …parameter 1 from 'char *(__cdecl *)(void)' to '
const
char *' [/QUOTE] error Could you please help …
Re: Const passing problem
Programming
Software Development
11 Years Ago
by mike_2000_17
… declaration: class DirectionSequence { //... int size()
const
; // notice the '
const
' here, // it means this function will … other functions. // now, the size function: int size()
const
{ return tn; }; private: //.. only the private data members…
Re: Const Question - Why is this happening?
Programming
Software Development
15 Years Ago
by Sci@phy
… very interesting. Well, first thing, i managed to call
const
constructor by doing this to main: [CODE=cplusplus] int… main () {
const
MyClass f(4); cout << "In main … [/CODE] So, if u pass
const
object to Func, it will obviously trigger
const
constructor. I'll post if i find…
Re: Const Question - Why is this happening?
Programming
Software Development
15 Years Ago
by VernonDozier
….c++/browse_thread/thread/16f1dd6dc3cf8fed/1d9e5fea271ef312?lnk=st&q=non-
const
+copy+constructor+group%3Acomp.lang.c%2B%2B#1d9e5fea271ef312[/url…?[/QUOTE] Thanks. Well it shows an example of a
const
and non-
const
constructor, so that's relevant. I'm not using…
1
2
3
17
Next
Last
Search
Search
Forum Categories
Hardware/Software
Programming
Digital Media
Community Center
Latest Content
Newest Topics
Latest Topics
Latest Posts
Latest Comments
Top Tags
Topics Feed
Social
Forums
Top Members
Meet People
Community Functions
DaniWeb Premium
Newsletter Archive
Markdown Syntax
Community Rules
Developer APIs
Connect API
Forum API Docs
Tools
SEO Backlink Checker
Legal
Terms of Service
Privacy Policy
FAQ
About Us
Advertise
Contact Us
© 2024 DaniWeb® LLC