Hey guys. I’m stuck on the Object of your Affections project. (https://www.codecademy.com/courses/learn-c-plus-plus/projects/cpp-dating-profile)
I am getting stuck on step 10.
app.cpp
#include <iostream>
#include "profile.hpp"
#include <vector>
int main() {
Profile sam("sam", "dancing");
sam.view_profile();
}
profile.hpp
#include <vector>
#include <string>
class Profile{
private:
std::string name;
int age;
std::string city;
std::string country;
std::string pronouns;
std::vector<std::string> hobbies;
public:
Profile(std::string new_name, std::string new_hobbies);
void add_hobby(std::string new_hobby);
std::string view_profile();
};
profile.cpp
#include <iostream>
#include "profile.hpp"
Profile::Profile(std::string new_name, std::string new_hobbies)
:name(new_name), hobbies(new_hobbies)
{
}
std::string Profile::view_profile(){
std::cout << name;
std::cout << hobbies;
}
void Profile::add_hobby(std::string new_hobby){
hobbies.push_back(new_hobby);
}
This is the error I keep getting.
A little background. I’m a game developer, and I make special effects. I’m trying to learn c++ to be a more rounded and technical game developer as well as make my own projects. SO i decided to start learning C++ on my own here at codecademy, so I can get the basics down. Right now Classes have got me stumped apparently.