Vote count:
0
1 :- In the code give below I got an error message that "there is no default constructor" .that's why I can't use uniform initializer.
- 2 :- When I made a default constructor then I got an error regarding braces .
Kindly highlight the problem about this program and uniform initiallizer. I am using VS 2012 and C++
**Code starts here**
class Circle {
double radius;
public:
Circle(double r) { radius = r; }
double circum() {return 2*radius*3.14159265;}
Circle () {
cout<<"ALI \n ";
}
};
int main () {
Circle baz {30.0}; // uniform init.
Circle qux{};
cout << "foo's circumference: " << baz.circum() << '\n';
cout<<endl;
return 0;
}
asked 38 secs ago
Aucun commentaire:
Enregistrer un commentaire