http://prnt.sc/130efe5
#include <iostream>
using namespace std;
class course
{
int courseNumber;
int creditHours;
public:
void setCourse(int x, int y);
};
void course::setCourse(int x, int y)
{
courseNumber = x;
creditHours = y;
}
class section
{
int secNumber;
course c; // composition
public:
void setSection(int, int, int);
};
void section::setSection(int x, int y, int z)
{
c.setCourse(x, y);
secNumber = z;
}
int main()
{
section obj[7];
for (int i = 1; i < 8; i++)
{
obj[i-1].setSection(117, 3, i);
}
}
Comments
Leave a comment