Draw a UML class diagram that describes the classes defined
below. Setter and getter functions were omitted for simplicity.
Your diagram should capture as much information about the code as
possible. Upload a PDF or image file containing your diagram
#include <list>
#include <iostream>
class Object
{
public:
virtual void print() const = 0;
};
class Point : public Object
{
private:
double x,y;
public:
void print() const { std::cout << x << " " <<
y << std::endl; }
};
class Drawable : public Object
{
public:
virtual void draw() const = 0;
};
class Circle : public Drawable
{
private:
Point center;
double radius;
public:
void print() const { center.print(); std::cout << radius
<< std::endl; }
void draw() const { /* ... */ }
};
class Picture : public Drawable
{
private:
std::list<Drawable*> items;
public:
void print() const { for(auto i:items) i->print(); }
void draw() const { for(auto i:items) i->draw(); }
};
Draw a UML class diagram that describes the classes defined below. Setter and getter functions were omitted for simplici
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
Draw a UML class diagram that describes the classes defined below. Setter and getter functions were omitted for simplici
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!