+ 1
Member Intializers
cin error and any clarity into solving this https://code.sololearn.com/cA61i1S2kwlE/?ref=app
3 odpowiedzi
+ 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..
}
+ 1
excellent explanation
Thank you!
+ 1
You're welcome..