
262 Classes and Objects
b->qty= 75;
cout<<“\n\n With pointer to structure”;
cout<<“\n Codeno : ”<<b->codeno;
cout<<“\n Prize : ”<<b->prize;
cout<<“\n Qty : ”<<b->qty;
return 0;
}
Explanation: The above program is the same as previous one. The output is also same, hence not
shown. Consider the following statement.
item a,*b; // object declaration in c++
While declaring an object, the keyword struct is omitted, which is compulsory in C. The
structure item is a user-defined data type. C++ itself behaves as a structure data type which is
built-in type and allows variable declaration.
C++ introduces new keyword class, which is similar to structure. ...