0% found this document useful (0 votes)
30 views2 pages

Code Result

This C++ code defines a CourseCodeOfOpp class with private data member courseCode and public constructor, setCourseCode(), getCourseCode(), and displayMessage() methods. The main function creates a CourseCodeOfOpp object, calls its displayMessage() method to output the course code, and waits for user input before returning.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views2 pages

Code Result

This C++ code defines a CourseCodeOfOpp class with private data member courseCode and public constructor, setCourseCode(), getCourseCode(), and displayMessage() methods. The main function creates a CourseCodeOfOpp object, calls its displayMessage() method to output the course code, and waits for user input before returning.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

// CourseCodeOfOpp.

h
// CourseCodeOfOpp class definition in a separate file from main.
#include <iostream>
#include <string>
using namespace std;
class CourseCodeOfOpp
{
private:
int courseCode;
public:
CourseCodeOfOpp( int CourseCode )//Constructor
{
setCourseCode( CourseCode );
}
void setCourseCode( int Coursecode ) //First Function
{
courseCode = Coursecode;
}
int getCourseCode() //Second Function
{
return courseCode;
}
void displayMessage() //Third Function
{
cout << "Course code of OOP is\n" << getCourseCode()<< "!" << endl;
}
};
// Including class CourseCodeOfOpp from file CourseCodeOfOpp.h for use in
main.

#include <iostream>
#include <conio.h>
#include "CourseCodeOfOpp.h"
using namespace std;
int main()
{
CourseCodeOfOpp CourseCode(1024);
CourseCode.displayMessage();
getch();
return 0;
}

You might also like