help me with classes pls

Can someone send me a tutorial where I can learn about classes, objects and constructors?
The professor will talk about about these topics this upcoming week but I just want to learn this now :)
In this hw I'm only allowed to write in the class section only I can't touch the main.
Any help will be appreciated thanks!
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#include <iostream>
#include <string>
using namespace std;

class Animals
{
};

  int main()
  {
	  string type, a1;

	  cout << "\nwhat's your favorite animal #1? ";
	  getline(cin, type);
	  cout << "Why do you like that animal? (ENTER for none): ";
	  getline(cin, a1);
	  Animals f1(type, a1);

	  cout << "\nwhat's your favorite animal #2? ";
	  getline(cin, type);
	  cout << "Why do you like that animal? (ENTER for none): ";
	  getline(cin, a1;
	  Animals f2(type, a1);

	  cout << "\nwhat's your favorite animal #3? ";
	  getline(cin, type);
	  cout << "Why do you like that animal? (ENTER for none): ";
	  getline(cin, a1);
	  Animals f3(type, a1);

	  cout << "\nwhat'bts your favorite animal #4? ";
	  getline(cin, type);
	  cout << "Why do you like that animal?(ENTER for none): ";
	  getline(cin, a1);
	  Animals f4(type, a1);

	  

	  cout << "\nData 1:" << endl;
	  f1.showInfo();
	  cout << "\nData 2:" << endl;
	  f2.showInfo();
	  cout << "\nData 3:" << endl;
	  f3.showInfo();
	  cout << "\nData 4:" << endl;
	  f4.showInfo();
	  
	  system ("pause");
	return 0;
}
Last edited on
Made a thread about the concepts the other day. http://www.cplusplus.com/forum/beginner/148353/

Started reading a book that is so far great and very explanatory, but older as someone pointed out in the thread is an older book. Worst case could could be a second reference book to go along with your class. Very much geared towards teaching OOP which I've heard schools can do a lackluster job at. Good luck
Topic archived. No new replies allowed.