I’m starting new on C++ programming on UE4 but I am no stranger to programming. I’ve had experience coding with Java and Swift before and I know the basics about Object oriented programming.
In Java, we can create classes such as:
Class Fruit {
int taste;
double weight;
}
And we can create objects for these such as:
Class main{
Fruit banana;
banana.taste = 10;
banana.weight = 30.5;
}
Note that the Fruit is a custom object and want to implement such a principle in UE4. I tried doing it this way in C++ syntax inside VS2015 in a UE4 project but it doesnt work/build.
What is the correct way of doing it??
woah.
Thank you so much!
Just a follow up question, if I were to create this in the Unreal Engine 4 editor, I’m gonna have to:
Add C++ Class
Then set it to None
Is that right?
And can I reference this class in other C++ classes?
For example, in MyActor C++ class, can I declare and use the Fruit object inside it?
That depends if you want a class or a struct. But I highly recommend you to read some C++ guides if you’re not familiar with those concepts. This is beyond UE4 and UE4 requires at least a basic understanding of c++