Initialization syntax question

So I have a base class and a derived class, and I'm confused how the initialization syntax works in the code

Base class
1
2
3
4
5
6
7
class Instructor {
   
   public:
   
   Instructor(string n) {
      name = n;
      }  


Derived class
1
2
3
4
5
class Adjunct : public Instructor{
   
   public:
   Adjunct (string n):Instructor(n) // Don't understand this syntax
   {}
Well, it initializes the Base class (Instructor).
http://en.cppreference.com/w/cpp/language/initializer_list
http://stackoverflow.com/questions/7405740/how-can-i-initialize-base-class-member-variables-in-derived-class-constructor
Last edited on
I think it'll be easier for me to understand if I can see it without the initialization syntax.

Lets say we have a constructor initialization syntax

1
2
3
4
Instructor(string n) : name(n){
 // Same as 
 // name = n;
}


Would
 
Adjunct (string n):Instructor(n)

be something along the line as

 
Instructor::Instructor(n)
Topic archived. No new replies allowed.