I want to make a square, a circle and a triangle in C++
do I start off with just making generalizations about a Shape and then get
specific for each shape
#include <iostream>
using namespace std;
class Shape {
double Diam = 0;
double Circum1 = 0;
double Circum2 = 0;
double Circum3 = 0;
}
public Square extends Shape {
double side = 5;
Circum1 = 4*side;
}
public Circle extends Shape {
double radius = 5;
double circumference = 0;
Circum2 = PI r2;
}
public Triangle extends Shape {
double side = 5;
Circum3 = l+l+l;
}
int main() {
Shape s s("Circle", "Square", "Triangle", true);
cout << b.get_Circum1() <<endl;
cout << b.get_Circum2( ) << endl;
cout << b.get_Circum2( ) << endl;
}
---------------------------------
Never miss an email again!
Yahoo! Toolbar alerts you the instant new Mail arrives. Check it out.
[Non-text portions of this message have been removed]