for my c++ assignment, I just have to create a 'char', print it, then pass it as a reference argument to a function, modify it, and reprint it to prove that it has been changed. It seems easy, and I'm probably making a really dumb mistake, but i keep getting an error that says 'unresolved externals'. I've made a .cpp file and also declared a class in my header file.
My .cpp file:
#include <iostream>
#include <fstream>
#include "referenceshw.h"
using namespace std;
int main(){
char s = 's';
char& s1 = s;
Ref test;
std::cout << s <<endl;
test.modify(s);
}
void modify(char& s1){
s1 = 'd';
std::cout << s1 <<endl;
std::cout << s <<endl;
}
My header file:
#ifndef _REFERENCESHW_H
#define _REFERENCESHW_H
class Ref{
public:
char s;
void modify (char);
};
#endif