Hi

I have a virtual function setStartupDirectory()

virtual bool setStartupDirectory(const SysString &sStartupDirectory) = 0;

When I am calling this function
setStartupDirectory((const SysString &)m_pApplicationFolderNarrow);
I am getting this error
Error 2 error C2664: 'setStartupDirectory' : cannot convert parameter 1 from 'const SysString' to 'const SysString &'

Am I missing something

Recommended Answers

All 3 Replies

Here..

virtual void CSample1::Sample(SysString str)
(
   if(str.empty())
      return;
   //...
)
virtual void CSample2::Sample(SysString &str)
{
   str="what's up";
}
int main()
{
   SysString str1="check";
   SysString str2;
   CSample1 s1;
   CSample2 s2;
   s1.Sample(str1);
   s2.Sample(str2);
   return 0; 
}

Hi

I have a function
bool setStartupDirectory(const SysString &sStartupDirectory)
{}

Now I want to give the prototype of the function how can I do that

You can directly make the call to the function as follows

setStartupDirectory(m_pApplicationFolderNarrow);

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.