-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_syntax.cpp
More file actions
42 lines (34 loc) · 817 Bytes
/
test_syntax.cpp
File metadata and controls
42 lines (34 loc) · 817 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
36
37
38
39
40
41
42
#include <iostream>
#include <string>
#include <vector>
/**
* Test C++ file for syntax highlighting
*/
// Simple class example
class Person {
private:
std::string name;
int age;
public:
Person(const std::string& n, int a) : name(n), age(a) {}
void introduce() const {
std::cout << "Hi, I'm " << name
<< " and I'm " << age << " years old." << std::endl;
}
// Getters
std::string getName() const { return name; }
int getAge() const { return age; }
};
int main() {
// Create some people
std::vector<Person> people = {
Person("Alice", 25),
Person("Bob", 30),
Person("Charlie", 35)
};
// Introduce everyone
for (const auto& person : people) {
person.introduce();
}
return 0;
}