Learning C at school and wondering if i should try to pick up C++ too

Basically, I am learning C at school (have had 2 classes and 1 lab so far). I need to learn it for the diploma i am getting (for trades). But I am wondering if i should try to pick up C++ at the same time. I know C++ is harder but if the basic rules are more or less the same, I might be able to hit two birds with one stone, or maybe get close.

Anyways I don't know that much about C or C++, so i have no idea if what i am saying is do-able or not. Or if it is worth the time. I won't be learning C++ at school, and it would be on my own time. But knowing more isn't actually a bad thing, and who knows C++ down the line might be useful.
I would start learning C++ as well. While the languages are essentially in a different programming paradigm (although you can achieve OOP with C) you should have no problem learning both as long as your can remember what language uses malloc and what uses new :).
C++ is object oriented while C isn't. C++ is much more powerful to some. If you want, it's totally up to you. Through hearsay, I've heard that C teaches a lot of things you wouldn't do in C++.

Wait for a more educated answer I guess. If you want, go right ahead -- it won't hurt anything.
C++ is more than just object oriented
it is roughly divided to 4 parts by the effective C++
1:C
2:oop
3:stl
4:template C++

you don't need to know all of them, but you would find out that stl + template are
very powerful and find out that oop maybe not be a good way in many cases
Object-oriented is a style of programming, not a language feature. However, c++ makes OO easier by adding special keywords. For an example of OO code in C, I present to you the definition of the enemy base class, and the turret derived class, from my current game project.
1
2
3
4
5
6
7
8
9
10
11
12
struct enemy {
	float x,y,th;//position and rotation of the enemy
	int hitbox,hp;//size of the target, number of shots to kill this enemy
	void *data;//contains private data, may be different based on type of enemy
	BITMAP *spr;//sprite used to represent this enemy
	void (*ai)(struct enemy *e);//ai function, called every frame, set to zero to delete the enemy during cleanup.
};
struct turret{//private data for the turret enemy type.
	float xv,yv,shotv;//velocity, and the muzzle velocity for the gun
	int shotbox,shotrate;//size of the bullet,delay in 60ths of a second between shots
	BITMAP *shotspr;//sprite used for bullets.
};

By reading the comments you can see that I've even implemented garbage collection for the enemies.
Note bene that the turret class is not known outside enemy.c. It is not in enemy.h.
Last edited on
You'd expect the answer to be yes if you ask that on a C++ forum. But really, yes, learn C++. It'll make you a more versatile and marketable programmer.
Last edited on
Topic archived. No new replies allowed.