Easy learning with example program codes

CPP Aggregation

The process of defining a class by some other class as any entity reference is termed as aggregation in CPP programming. In other words, aggregation can be defined as the process of reusing a class in a form of association. In CPP, the term aggregation means “HAS-A relationship.”


#include <iostream.h>
using namespace std;
class Student
string Name;  
float ID;
Student(string Name, float ID) 	 
this-> Name = Name;    
this-> ID = ID;   
class Details   
Student* std;  
int stdclass;    
string section;    
Details(int stdclass, string section, Student* std)    
this->stdclass = stdclass;    
this->section = section;    
this->std = std;    
void detail()
cout << "Student Class : " << stdclass << endl;
cout << "Student Section : " << section << endl;
cout << "Student Name : " << std->Name<< endl;
cout << "Student ID : "<< std->ID << endl;  
int main()
Student s1 = Student("Khush", 1);    
Details d1 = Details(6, "A", &s1);  
return 0;


Student Class : 6    
Student Section : A  
Student Name : Khush  
Student ID : 1
Posted in CPP   

Industrial Training

We offers Placement Oriented Training on Java, Spring, JSF, Hibernate, PHP, AngularJS, Angular 4, PLSQL, Oracle BI Publisher etc. We also provides Online training, please mail us at


We also provides the Development services for Website Development , Java Development, PHP Development, Android App Development etc. You can contact us on

Copyright © 2019 CodesJava Protection Status SiteMap Reference: Java Wiki