Professional Documents
Culture Documents
Lecture 05 PDF
Lecture 05 PDF
• Once a class has been declared, we can create variables of that type by
using class name (like any built-in type variable)
item x;
• In C++, class variables are known as objects class employee
• X is object of type item {
private:
• Objects can also be created when a class is declared. char name[20];
int age,sal;
class item public:
{ void putdata();
- - -; };
- - -;
- - -;
}x,y,z; Array of objects employee emp[5];
Prof. Monidipa Das, Department of CSE, IIT (ISM) Dhanbad
Defining Member Functions 5
}
};
• Example item x;
x.getdata(100,75.5);
x.putdata();
Questions?