28 lines
384 B
C++
28 lines
384 B
C++
|
#include <iostream>
|
||
|
|
||
|
class Person
|
||
|
{
|
||
|
std::string name;
|
||
|
|
||
|
public:
|
||
|
|
||
|
Person(std::string name)
|
||
|
{
|
||
|
this->name = name;
|
||
|
}
|
||
|
|
||
|
void greet()
|
||
|
{
|
||
|
std::cout << "Hello, my name is " << this->name << "!" << std::endl;
|
||
|
}
|
||
|
};
|
||
|
|
||
|
int main(int argc, char* argv[])
|
||
|
{
|
||
|
auto person = new Person("Madison");
|
||
|
person->greet();
|
||
|
delete person;
|
||
|
|
||
|
return 0;
|
||
|
}
|