Have you nailed C++ once you understand Pointers?

closed account (ypfz3TCk)
Someone said that once you get pointers and arrays and understand the topic well, then you have licked learning C++

I know that pointers is a complex topic that applies to a lot of C++ - but would you agree that this is true??
It's a milestone for sure, but there's a lot more to the language than just pointers. So I'd say no.
Pointers, then templates and then OOP (that's in chronological order) were the hardest parts for me. It took me ages to fully understand OOP; in fact I finally got my head around it when I read Oracle's Java tutorial and it explained about objects being like real objects in that they have a state and a behaviour. As an example, a monitor has a few states - on, off, on and drawing, on and idle:
1
2
3
4
5
6
7
8
9
10
11
12
enum monitor_state {
	MONITOR_OFF = 1 << 0,
	MONITOR_ON = 1 << 1,
	MONITOR_DRAWING = 1 << 2,
	MONITOR_IDLE = 1 << 3
};

class monitor {
	private:
		unsigned state;
	// ...
};


It also has behaviours - turn off, turn on and refresh, for example:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// ...
	public:
		void turn_on()
		{
			this->state |= MONITOR_ON;
		}

		void turn_off()
		{
			this->state |= MONITOR_OFF;
		}

		void refresh()
		{
			if ((this->state & MONITOR_OFF) == MONITOR_OFF) // Only refresh if turned on
				return;
			this->state |= MONITOR_DRAWING;
			this->draw();
			this->state |= MONITOR_IDLE;
		}
// ... 

Thinking about objects like this and writing a few classes to represent real-world objects has finally made me understand OOP.
The answer is no.
Topic archived. No new replies allowed.