-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathraf.cpp
More file actions
35 lines (28 loc) · 908 Bytes
/
raf.cpp
File metadata and controls
35 lines (28 loc) · 908 Bytes
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
#include <iostream>
#include <string>
using namespace std;
// Define an abstract class (interface) called "CalendarInterface"
class CalendarInterface {
public:
// Pure virtual method to get the name of the month
virtual string getMonthName() = 0;
// Pure virtual method to get the number of days in the month
virtual int getNumDays() = 0;
};
// Concrete class that implements the CalendarInterface
class MyCalendar : public CalendarInterface {
public:
string getMonthName() override {
return "February"; // Example: Replace with actual month name
}
int getNumDays() override {
return 28; // Example: Replace with actual number of days
}
};
int main() {
MyCalendar calendar;
// Access the interface methods
cout << "Month: " << calendar.getMonthName() << endl;
cout << "Number of days: " << calendar.getNumDays() << endl;
return 0;
}