Class

  • + 1 comment

    include

    include

    using namespace std; class student { private: int age; char firstname[21]; char lastname[21]; int standard; public: void setage(int age) { this->age=age; } int getage() { return this->age; } void setfirstname(const char *t) { strcpy(firstname,t); } void getfirstname(char *a) { strcpy(a,firstname);

    }
    void setlastname(const char *t)
    {
        strcpy(lastname,t);
    }
    void getlastname(char *a)
    {
        strcpy(a,lastname);
    
    }
    void setstandard(int standard)
    {
        this->standard=standard;
    }
    int getstandard()
    {
        return this->standard;
    }
    

    }; int main() { student s; s.setage(15); s.setfirstname("john"); s.setlastname("carmack"); s.setstandard(10); char fr[21]; char ls[21]; s.getfirstname(fr); s.getlastname(ls); cout<