previous | start | next

C Strings: As Class Members (1)

Here is a very simple class with a C-string member:

class Person
{
  char name[50];
public:
  Person(const char nm[]);
  const char * getName() const;
};

In the Person.cpp file, the implementations are

Person::Person(const char nm[])
{
  strcpy(name, nm);
}

const char * Person::getName() const
{
  return name;
}

What restrictions do all the const qualifiers imply?



previous | start | next