Write the contents of a specification file for a class named ContestResult that contains the following members: An data member winner of type string, initialized to the empty string An data member secondPlace of type string, initialized to the empty string. An data member thirdPlace of type string, initialized to the empty string. A member function called setWinner that has one parameter, whose value it assigns to the data member winner. A member function called setSecondPlace that has one parameter, whose value it assigns to the data member secondPlace. A member function called setThirdPlace that has one parameter, whose value it assigns to the data member thirdPlace. A member function called getWinner that has no parameters and that returns the value of the data member winner. A member function called getSecondPlace that has no parameters and that returns the value of the data member secondPlace. A member function called getThirdPlace that has no parameters and that returns the value of the data member thirdPlace.
OOPs
In today's technology-driven world, computer programming skills are in high demand. The object-oriented programming (OOP) approach is very much useful while designing and maintaining software programs. Object-oriented programming (OOP) is a basic programming paradigm that almost every developer has used at some stage in their career.
Constructor
The easiest way to think of a constructor in object-oriented programming (OOP) languages is:
Write the contents of a specification file for a class named ContestResult that contains the following members:
- An data member winner of type string, initialized to the empty string
- An data member secondPlace of type string, initialized to the empty string.
- An data member thirdPlace of type string, initialized to the empty string.
- A member function called setWinner that has one parameter, whose value it assigns to the data member winner.
- A member function called setSecondPlace that has one parameter, whose value it assigns to the data member secondPlace.
- A member function called setThirdPlace that has one parameter, whose value it assigns to the data member thirdPlace.
- A member function called getWinner that has no parameters and that returns the value of the data member winner.
- A member function called getSecondPlace that has no parameters and that returns the value of the data member secondPlace.
- A member function called getThirdPlace that has no parameters and that returns the value of the data member thirdPlace.
A class is a group of objects which have common properties.
A constructor is a method that is used to initialize objects. It is called when an object of a class is created.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps