define a konstant

J

John Smith

How to define a constant with default value in a class?
I'd like to define a boolean constant, for example
const bool b = false;

Thanks
 
?

=?iso-8859-1?q?Erik_Wikstr=F6m?=

How to define a constant with default value in a class?
I'd like to define a boolean constant, for example
const bool b = false;

class Foo
{
const bool b;
public:
Foo(bool arg = false);
}

Foo:Foo(bool b) : b(arg) {}
 
B

BobR

/* """
How to define a constant with default value in a class?
I'd like to define a boolean constant, for example
const bool b = false;

class Foo{
const bool b;
public:
Foo(bool arg = false);
}

Foo:Foo(bool b) : b(arg) {}
""" */

<choke><gag> I bet I hate 'typos' as much as you. <G>

Foo::Foo( bool arg ) : b(arg) {}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,294
Messages
2,571,511
Members
48,211
Latest member
ChloeK3656

Latest Threads

Top