jeudi 19 mai 2016

How to calculate LCOM & LCOM HS for a C++ class

While reading the article, I came across the term LCOM & LCOM HS. This gets used further to identify regarding how cohesive a class is.

To understand it, I just wrote a sample class which is as follows:

class Test
{
public:
    Test()
    ~Test();
    Test(const Test& x);
    Test& operator=(const Test& x);
    int GetA()  {// uses a}
    int GetB()  { // uses b}
    int SumAB() { // uses a & b}
private:
    int a;
    int b;
    static int c;
};

int Test::c; //defined c 

M  = 7;
F  = 2;  // 2 or 3 ?
MF = 3;    Sum(MF) = ??  // I did not understand fully about this.

I wanted to know that whether my understanding is correct or not. Any further explanation(with some other class example) would be great to aid on my understanding.

Aucun commentaire:

Enregistrer un commentaire