How do I position the interface on top?
1. How to position the interface ICreditCard on top of MoneyBack?
2. How to position the interface ICreditCard on top in the middle between above MoneyBack and Program?
3. How to position the interface ICreditCard correctly on top: should it be on top or on the bottom?
4. Did I make the diagnosis correctly?
I want the Program and MoneyBack classes to be on the same line, and
title Class Diagram
' === ===
left to right direction
skinparam linetype ortho
' === ===
together {
class Program {
+ Main(args: string[]): void
}
class MoneyBack {
+ GetCardType(): string
+ GetCreditLimit(): int
+ GetAnnualCharge(): int
}
}
interface ICreditCard {
+ GetCardType(): string
+ GetCreditLimit(): int
+ GetAnnualCharge(): int
}
' === ===
Program -up-> ICreditCard
Program ..> MoneyBack
ICreditCard <|-up- MoneyBack
Program
class Program
{
static void Main(string[] args)
{
ICreditCard creditCard;
creditCard = new MoneyBack()
}
}
ICreditCard
public interface ICreditCard
{
string GetCardType();
int GetCreditLimit();
int GetAnnualCharge();
}
MoneyBack
public class MoneyBack : ICreditCard
{
public string GetCardType()
{
return "MoneyBack";
}
public int GetCreditLimit()
{
return 15000;
}
public int GetAnnualCharge()
{
return 500;
}
}
How do I make the Program and MoneyBack classes aligned at the top?
How about not using the left to right syntax and reorganizing the references to:
@startuml
title Class Diagram
' === ===
skinparam linetype ortho
' === ===
together {
class Program {
+ Main(args: string[]): void
}
class MoneyBack {
+ GetCardType(): string
+ GetCreditLimit(): int
+ GetAnnualCharge(): int
}
}
interface ICreditCard {
+ GetCardType(): string
+ GetCreditLimit(): int
+ GetAnnualCharge(): int
}
' === ===
ICreditCard <-down- Program
ICreditCard <|-down- MoneyBack
Program .right.> MoneyBack
@enduml
which gives:
Update 1: plantuml does not provide a feature for aligning classes at their top, but this other answer explains a workaround.