+ 1

Member Intializers

cin error and any clarity into solving this https://code.sololearn.com/cA61i1S2kwlE/?ref=app

5th May 2022, 11:13 AM
Lee 4 Code
Lee 4 Code - avatar
3 Answers
+ 2
#include <iostream> using namespace std; class TV { public: TV(int h, int w): height(h), width(w) {}; void area() { cout <<height*width; } private: int height; int width; }; int main() { //your code goes here int height; int width; cin>> height; // invalid cin>> int height; cin>> width; TV obj(height , width); // create object obj.area(); //then call function by object.. }
5th May 2022, 11:18 AM
Jayakrishna 🇼🇳
+ 1
excellent explanation Thank you!
5th May 2022, 11:40 AM
Lee 4 Code
Lee 4 Code - avatar
+ 1
You're welcome..
5th May 2022, 11:56 AM
Jayakrishna 🇼🇳