Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

data classes and abstraction.

montoya35montoya35 Member Posts: 4
i have not understood classes in c++.please explain it to me.

Comments

  • stoberstober Member Posts: 9,765 ✭✭✭
    : i have not understood classes in c++.please explain it to me.
    :

    Very simply, a class is just a way of grouping together objects and functions for a common purpose. For example, a student file at a university might contain the student's name, address, city, state, zip code, and telephone number. so the class could be constructed like this:
    [code]
    #include

    class CStudent
    {
    public:
    CStudent(); // constructor
    ~CStudent(); // destructor
    void PutName(string& n) {name = n;}
    string GetName() {return name;}

    protected:
    std::string name;
    std::string address;
    std::string city;
    std::string state;
    std::string zip_code;
    std::string phone;
    };
    [/code]

  • Shawn CarterShawn Carter Member Posts: 0

    ___ < http://forcoder.org /> free video tutorials and ebooks about | Assembly JavaScript Objective-C C++ C# Swift Java PHP Ruby Go MATLAB Scratch PL/SQL Visual Basic Visual Basic .NET R Delphi C Python Perl Apex Ada D LabVIEW VBScript Lua ABAP Erlang SAS Julia Dart Crystal Awk Clojure COBOL Lisp Transact-SQL Alice Bash Rust Kotlin Scheme F# Scala Hack Logo ML FoxPro Prolog Fortran | ______

Sign In or Register to comment.