Write A Program Of Composition in OOP
#include<iostream>
#include<string.h>
#include<conio.h>
using namespace std;
class student
{
int roll_no;
int marks;
public:
void get()
{
cout<<"Enter roll no"<<endl;
cin>>roll_no;
cout<<"Enter marks:"<<endl;
cin>>marks;
cout<<"***********\n";
cout<<"roll is "<<roll_no;
cout<<"\nmarks is "<<marks;
}
};
class university
{
student s1;
public:
void get()
{
s1.get();
}
};
int main()
{
university l1;
l1.get();
getch();
return 0;
}
#include<string.h>
#include<conio.h>
using namespace std;
class student
{
int roll_no;
int marks;
public:
void get()
{
cout<<"Enter roll no"<<endl;
cin>>roll_no;
cout<<"Enter marks:"<<endl;
cin>>marks;
cout<<"***********\n";
cout<<"roll is "<<roll_no;
cout<<"\nmarks is "<<marks;
}
};
class university
{
student s1;
public:
void get()
{
s1.get();
}
};
int main()
{
university l1;
l1.get();
getch();
return 0;
}