+ 2
a class can be thought of as a collection of things that make up something. it's variables and functions. think of a dog for example. it has certain variables: string breed, double height, char gender etc. it also has certain functions like bark, fetch, sit. that would look something like this class Dog { private: string breed; double height; char gender; public: Dog (string,double,char); void bark(); }; an object is simply an instance of a class. so in our dog example we could create a "Dog" by doing this: Dog myDog (boxer,4.3,m); which. would create a dog object called myDog. of course I never actually set up the constructor but you get the idea
11th Aug 2016, 2:11 AM
destro