What is a class?

I was watching this tutorial and he kept talking to me about a ‘class’. I have no idea what this means and when I googled it a bunch of stuff I didn’t understand came up. I don’t have much experience with coding and I thought I should learn C++ because blueprints seem limited. If someone could explain it simply it would be appreciated.

Thanks in advance!

A class is like the blueprints of an object it determines what it will be. For example a car could be thought of as a class and it will have attributes and methods. The attributes may be colour: red door: 4 and the methods may be ignitionOn(), turnRight(). So lets say we have two objects of the car class one my be a red car with 5 doors and another may be a blue car with 2 doors.

That is the concept of a class but a class in UE4 you can get Pawn, Actor and others. If you read the descriptions you can see what they do. The idea is that they are the blueprints then you punch in the details to get the object you desire.

Ok thanks!

Classes are custom types that can contain both variables and functions.

class MyClass
    int MyInt;

    void MyFunction()
        // do stuff

That’s probably the simplest definition I can give. There is allot to classes however. The only real difference between c and c++ is just the introduction of classes! So I would take it slow and don’t feel bad if you get confused sometimes.

Looks like I was beaten and with a much better explanation!

Thanks! For the example! By the way, to learn C++ for Unreal Engine can I only follow c++ Unreal Engine tutorials or can I just follow general c++ tutorials? I remember when I used Unity, Unity’s JavaScript was a lot different to normal JavaScript so I had to follow Unity specific tutorials. Will it be the same for UE?

I would recommend both but I think the best way to learn is by looking at sample code and figuring out what it does and use the API to find other variables, functions, classes and that.
Also remember that UE4 has its own notation such as vectors being of the type name FVector instead. Essentially it is just a vector but it may seem confusing when reading it.
On the API there is a section that mentions about the notation used so if you read that and learn general C++ you should be able to understand.

No one expects you to remember everything so going to sample code is always useful.
So you could open up some of the sample projects and see how each section of code does certain things.

At first it will be hard but if you keep doing it, it will get much easier as your brain will adapt

Thanks for the advice! Do you know where I can find some sample code/projects?

Well when you start a new project on UE4 you have the option to select C++ pre made projects such as 1st person and car.
Open one of those and take a look at the code then you can see how it does all of the functionality. Then you can take pieces of code
and apply them to your own programs. This will help you to understand a lot more than tutorials will as it’s you thinking.