Question: Member Initializers You are making a program to store TVs with their width and height. The given program declares a TV class with height and

Member Initializers

You are making a program to store TVs with their width and height. The given program declares a TV class with height and width members, an area() method, as well as a constructor that initializes the members of the class. Complete the program by taking 2 integers as input, create a TV object by passing them to the constructor, and call the area() method.

Note, that the constructor needs 2 integer values.

#include

using namespace std;

class TV {

public:

TV(int h, int w): height(h), width(w) {};

void area() {

cout <

}

private:

int height;

int width;

};

int main() {

//your code goes here

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!