Where should "using" be placed

I am writing a program that has one header file. However, I have always put "using namespace std;" after all the includes which means that the header file never sees that declaration. The problem that I have come across is when I try to set a function to return a string, I would have to put std::string in order for the program to compile.

So my question is should I use std::string in the header, or should I include "using namespace std" inside the header file?

source.cpp
1
2
3
4
5
6
7
8
9
 #include <iostream>
#include <string>
#include "functions.h"
using namespace std;

int main()
{
    
}


functions.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25

#ifndef FUNCTIONS_H
#define FUNCTIONS_H

class Student
{

  public:

      int getID();
      string getFullName();
      string getDOB();
      int getYearStarted();
      string getAddress();
      void changeName( string );
      void changeDOB( int, int, int );
      void changeYearStarted( int );
      void changeAddress();
      string toString();

  private:

};

#endif 
It's bad practice to put using namespace std; in a header file, as any file which includes the header will find itself with that using whether it wants it or not.

Better to explicitly put std::string in the header.
Thank you, I was confused about this convention and I'm trying to stick to them as much as possible so I'm not confused in the future.
Topic archived. No new replies allowed.