Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 12:24 Go to next message
sadasivam arumugam is currently offline sadasivam arumugamFriend
Messages: 3
Registered: February 2021
Junior Member
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 13:15 Go to previous messageGo to next message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 4249
Registered: July 2009
Senior Member

I think you're looking for https://staruml.io/support . StarUML is not provided by eclipse.,org.

Nitin Dahyabhai
Eclipse Web Tools Platform
Re: Instance in class diagram [message #1837843 is a reply to message #1837838] Mon, 08 February 2021 14:29 Go to previous message
sadasivam arumugam is currently offline sadasivam arumugamFriend
Messages: 3
Registered: February 2021
Junior Member
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: Wed Aug 17 04:49:24 GMT 2022

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

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

Back to the top