/*********************************************************************************** ************************************************************************************ * NewPart01.cpp * * * * Purpose : Design Object StudentType to include Student.Name and Part.No * * Note that the ObjectType is being created, but no * * objects (instances) are created in Part1_1.cpp!. * * * * Written By : Dr. Thomas E. Hicks Hardware : IBM * * Date : 9/5/97 Compiler : Visual C++ (5.0) * * * ************************************************************************************ ***********************************************************************************/ # include # include class StudentType { public: StudentType(void) // constructor { puts( "Entering Constructor [PartType (void)]\n"); strcpy (Name,""); strcpy (Dept,""); Age = 0; PayRate=0; puts( "Exiting Constructor [PartType (void)]\n"); } void Print (char Message[]) { puts (Message); printf ("Name = %s\n",Name); printf ("Age = %d\n",Age); printf ("Dept = %s\n",Dept); printf ("Pay Rate = %6.2f\n\n",Dept); } private: char Name[20], Dept[15]; int Age; float PayRate; }; int main(int argc, char * argv[]) { puts("---------------------- Start of main -----------------"); StudentType WorkStudy; WorkStudy.Print("WorkStudy"); puts("---------------------- End of main -------------------"); return (0); } /* Output ---------------------- Start of main ----------------- ---------------------- End of main ------------------- */