Kadia64
Kadia64

Reputation: 1

Default Function Parameters in C++ Header/Class Files

I have a function 'transfer(int arr[12][7], char letter = 'a')' that is in another class with a header files that takes in 2 parameters. I am trying to set the letter as a default parameter, so I wouldn't have to pass it into the function every time I call it. This function is also in another class (Typeface.cpp) with a header file (Header.h), but when I declare this function, I receive the error: "C2065 'letter': undeclared identifier". Is this just not possible in C++?

Typeface.cpp:

#include "Header.h"
void Typeface::transfer(int arr[12][7], char letter = 'a') {
    ...
}

Header.h:

#pragma once
class Typeface {
   private:
      void transfer(int arr[12][7], char letter = 'a'); 
};

Upvotes: 0

Views: 25

Answers (0)

Related Questions