bsc

Comprehensive codebase and cou...
Log | Files | Refs | Activity | README | LICENSE

root / semester_2 / eduincs / pgrm_003.cpp

pgrm_003.cpp (419B)


      1 /* class - object */
      2 
      3 #include<iostream>
      4 using namespace std;
      5 
      6 class person {
      7     public:
      8         int age;
      9         string name;
     10 
     11         void setName(string n) {
     12             name = n;
     13         }
     14 
     15         void setAge(int a) {
     16             age = a;
     17         }
     18 };
     19 
     20 int main() {
     21     person p;
     22     p.setName("Amit Dutta");
     23     p.setAge(19);
     24     cout << "Name: " << p.name << endl;
     25     cout << "Age: " << p.age;
     26     return 0;
     27 }
© notamitgamer • Site Built: 2026-09-05 01:53:16 UTC • git-mirror commit: c170d72 [view raw info]
Originally created with stagit • modified by notamitgamer
Forked from github.com/notamitgamer/git-mirror