InterviewSolution
| 1. |
Why is class known as composite data type ? |
|
Answer» The class is known as composite/flata type because a composite or reference data type are the data elements whose value is an address. The values in a composite data type cannot be assigned directly. It is assigned with the help of a reference. For example, if there are two public integer variables in class XYZ as A and B then the value to those variables cannot be assigned directly. They can be assigned with the help of the following reference: XYZ obj1; //creating an object of XYZ class Obj1.A=10; //referencing the variable. Obj1.B=20; Thus class is a composite data type because it requires a reference to use its attributes. |
|