1.

Which is the correct syntax for declaring static data member?(a) static mamberName dataType;(b) dataType static memberName;(c) memberName static dataType;(d) static dataType memberName;I had been asked this question during an interview for a job.The query is from Static Data Members topic in section Exception Handling & Static Class Members of Object Oriented Programming

Answer»

The correct choice is (d) static dataType memberName;

For explanation: The syntax must firstly be mentioned with the KEYWORD static. Then the DATA TYPE of the member followed by the member name should be given. This is general form of declaring static data MEMBERS.



Discussion

No Comment Found

Related InterviewSolutions