Initializing C++ string inside a constructor
- From: jainarunk@xxxxxxxxx
- Date: 10 May 2006 14:56:31 -0700
Hello folks,
I want to initialize a variable type string s inside the class
constructor
My code looks like this
class Simple {
public:
Simple();
string s;
};
The problem I am encountering that I can not initialize s in an
initialization list, because my
value to initialize 's' is generated inside the constructor
Simple::Simple() {
// a string "somevalue" is generated here after some code
// can I do
s("somevalue");
or I will have to do
s= "somevalue";
Please help.
thanks
Nagrik
.
- Follow-Ups:
- Re: Initializing C++ string inside a constructor
- From: Spoon
- Re: Initializing C++ string inside a constructor
- From: Carlos Moreno
- Re: Initializing C++ string inside a constructor
- Prev by Date: Re: How to change Network and Internet settings from a KDE application
- Next by Date: Re: Initializing C++ string inside a constructor
- Previous by thread: need help with bash and opentpy
- Next by thread: Re: Initializing C++ string inside a constructor
- Index(es):
Relevant Pages
|