In the header file, a class named Student has been declared and a structure named collector has been declared in private. I want to make one more cpp file and then make an electro structure in the private part of the main function and use it, but I don't know what to do. It's my first time using the site, so I'll take it with thanks if there's anything I'm not familiar
class c++
I hope the immature answer will be helpful.
main.cpp
#include <iostream>
#include "head.h" //Include here.
using namespace std;
int main() {
Student st;
st.setInit();
st.coutLecture();
return 1;
}
head.h
#pragmaence
class Student {
private:
struct { int x; int y; }lecture;
public:
void setInit() {
this->lecture.x = 3;
this->lecture.y = 6;
}
void coutLecture() {
std::cout << this->lecture.x << "," << this->lecture.y << "\n";
}
};
© 2024 OneMinuteCode. All rights reserved.