Skip to main content



      Home
Home » Modeling » UML2 » Instance in class diagram(Why are we unable to add instance and class within same class diagram?)
Instance in class diagram [message #1837833] Mon, 08 February 2021 07:24 Go to next message
Eclipse UserFriend
In specific, to model the cpp code(below snippet) into a class and sequence diagram, how we can do it in starUML software v3.2. Code is not generating? Unable to get it?

Or can you guide me to create uml for this code.?


/* The Circle class (All source codes in one file) (CircleAIO.cpp) */
#include <iostream> // using IO functions
#include <string> // using string
using namespace std;

class Circle {
private:
double radius; // Data member (Variable)
string color; // Data member (Variable)

public:
// Constructor with default values for data members
Circle(double r = 1.0, string c = "red") {
radius = r;
color = c;
}

double getRadius() { // Member function (Getter)
return radius;
}

string getColor() { // Member function (Getter)
return color;
}

double getArea() { // Member function
return radius*radius*3.1416;
}
}; // need to end the class declaration with a semi-colon

// Test driver function
int main() {
// Construct a Circle instance
Circle c1(1.2, "blue");
cout << "Radius=" << c1.getRadius() << " Area=" << c1.getArea()
<< " Color=" << c1.getColor() << endl;

// Construct another Circle instance
Circle c2(3.4); // default color
cout << "Radius=" << c2.getRadius() << " Area=" << c2.getArea()
<< " Color=" << c2.getColor() << endl;

// Construct a Circle instance using default no-arg constructor
Circle c3; // default radius and color
cout << "Radius=" << c3.getRadius() << " Area=" << c3.getArea()
<< " Color=" << c3.getColor() << endl;
return 0;
}

Re: Instance in class diagram [message #1837838 is a reply to message #1837833] Mon, 08 February 2021 08:15 Go to previous messageGo to next message
Eclipse UserFriend
I think you're looking for https://staruml.io/support . StarUML is not provided by eclipse.,org.
Re: Instance in class diagram [message #1837843 is a reply to message #1837838] Mon, 08 February 2021 09:29 Go to previous message
Eclipse UserFriend
Hi Nithin, yeah thanks but I am new to uml modelling. Can you guide me the steps for object orieted design. I have referred most of UML ebooks, but I cant able to find where to start with. Any ebooks with Cpp support for design.
Previous Topic:JUnit Test UML Model setValue IllegalArgumentException
Next Topic:UML RT metamodel
Goto Forum:
  


Current Time: Mon Jul 07 23:00:03 EDT 2025

Powered by FUDForum. Page generated in 0.03971 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top