Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <string>
- #include <iostream>
- class cStudent {
- private:
- std::string studentName;
- long groupNumber;
- float studentRate;
- public:
- cStudent(const std::string& name, long group, float rate) :
- studentName(name), groupNumber(group), studentRate(rate) { }
- ~cStudent() = default;
- friend std::ostream& operator<<(std::ostream& out, cStudent& st) {
- out << "Student " << st.studentName << " from group " << st.groupNumber << " has rate " << st.studentRate << "\n";
- return out;
- }
- };
- int main() {
- cStudent st("Hello World", 850505, 4.5);
- std::cout << st;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement