diff --git a/30 Days of Code/Day 04/Class vs. Instance.cpp b/30 Days of Code/Day 04/Class vs. Instance.cpp new file mode 100644 index 0000000..98340b0 --- /dev/null +++ b/30 Days of Code/Day 04/Class vs. Instance.cpp @@ -0,0 +1,30 @@ +class Person{ + public: + int age; + Person(int initialAge); + void amIOld(); + void yearPasses(); +}; + + Person::Person(int initialAge){ + + //code to run some checks on initialAge + if(initialAge<0) {cout<<"Age is not valid, setting age to 0."<age<13) cout<<"You are young."<age>=18) cout<<"You are old."<