-
Notifications
You must be signed in to change notification settings - Fork 2
CPP for Intermediates
This page will have CPP resources broken up by topic and will be most helpful to those who already have a good understanding of Java or OOP in general.
primitives in C++ are very similar to those in Java with some minor differences.
-
boolean
is changed tobool
-
long
is a modifier on int solong int
would belong
in java. They can be chained however so you can havelong long int
for a datatype even bigger than Java's - strings are not considered a primitive. you'll need to
#include <string>
to get access tostd::string
which operates similarly to Java's string.
for an examples go to W3Schools
- Structs work the same as Classes, just replace
class
withstruct
- observe the semicolon at the end of the last
}
The main difference between Classes and Structs is that Classes have private attribute visibility by default while Structs have public attribute visibility by default.
- in practice we use classes like in Java, while we use structs as data classes.
Classes in our code base are separated into 2 files a *.cpp
file and a .h
file. h
files are header files which contain declaration details while the cpp
files contain the implementation.
for more detail see this pdf
if you'd like a course designed to bring programmers up to scope in CPP then Codecademy has a course for CPP designed for people who already have knowledge in programming.