Day 6: User-defined datatypes

class

  • A user-defined datatype which groups together related pieces of information

Instance

  • An instance is an occurrence of a class
class student{
public:
    char *name;
    int studentID;
};

int main(){
    student s1;
    student s2;
}

 

Constructor

  • Method that is calle whien an instance is created.

struct: public by default

class:  private by default

你可能感兴趣的:(C++学习笔记)