First of all above c# code will never compile, because you are not specified the return type of setName and getName method.
modified version of C# code
class hello
{
private string _fname, _lname;
public hello(string fname, string lname)
{
setName(fname, lname);
}
public void setName(string fname, string lname)
{
_fname = fname;
_lname = lname;
}
public string getName()
{
return _fname + " " + _lname;
}
}
#include <string>
class Hello
{
public:
Hello(void);
Hello( const std::string& strFirstName, const std::string& strLastName);
void SetName( const std::string& strFirstName, const std::string& strLastName);
std::string GetName();
private:
std::string m_strFirstName;
std::string m_strLastName;
};
#include "Hello.h"
Hello::Hello(void)
{
}
Hello::Hello( const std::string& strFirstName, const std::string& strLastName):
m_strFirstName(strFirstName), m_strLastName( strLastName )
{
}
void Hello::SetName( const std::string& strFirstName, const std::string& strLastName)
{
m_strFirstName = strFirstName;
m_strLastName = strLastName;
}
std::string Hello::GetName()
{
return m_strFirstName + " " + m_strLastName;
}