-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexp6.cpp
40 lines (40 loc) · 831 Bytes
/
exp6.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include <iostream>
#include <vector>
#include <unordered_set>
using namespace std;
class ClassA
{
public:
void methodA()
{
cout << "Method A in ClassA\n";
}
};
class ClassB
{
public:
void methodB(ClassA &objA)
{
objA.methodA();
cout << "Method B in ClassB\n";
}
};
int calculateCBO(const std::vector<std::unordered_set<std::string>> &dependencies)
{
int cbo = 0;
for (const auto &set : dependencies)
{
cbo += set.size();
}
return cbo;
}
int main()
{
vector<std::unordered_set<std::string>> dependencies;
unordered_set<std::string> dependencySet;
dependencySet.insert("ClassA");
dependencies.push_back(dependencySet);
int cbo = calculateCBO(dependencies);
cout << "Coupling Between Objects (CBO): " << cbo << endl;
return 0;
}