x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Is there a C++ equivalent to MyClass_C ?

I prototyped a number of functions and classes in blueprints and now I'm starting to convert them into C++. When a blueprint is created there are two types related to it, MyClass (blue icon) and MyClass_C (purple icon). I've accomplished MyClass properties no problem, but how does one deal with MyClass_C in C++? As far as I can tell MyClass is the specific instance, MyClass_C is more of a type specifier. Not sure how to translate this into C++.

Product Version: Not Selected
Tags:
more ▼

asked Sep 26 '14 at 09:53 PM in C++ Programming

avatar image

Andrew Mac
1 1 2

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

The purple items (_C) are the classes themselves. For example, if I were to do typeof(MyClass) in C# the result of that would be a class object representing the reflection data of MyClass. The MyClass_C is pretty much that. You can access them in C++ by doing MyClass::StaticClass().

Cheers, Nick

more ▼

answered Sep 26 '14 at 10:08 PM

avatar image

Nick Darnell ♦♦ STAFF
6k 77 36 150

avatar image Andrew Mac Sep 26 '14 at 10:22 PM

Hey, thanks for the reply.

Yeah, the part I'm unsure of is in blueprints I made a property that was of the type MyClass_C. This way I could specify any derivative of it as the value to the that property. I could then use this to spawn a new instance of that specific class. It was part of my inventory system. In C++ I don't usually specify types as values so I'm a bit perplexed how to translate the blueprint to C++.

I can do:

UPROPERTY(blah) TAssetPtr AMyClass BlueIconProperty;

To replicate the blue one. How can I replicate the purple one?

edit: markup is messing up my code, I hope you get my meaning.

avatar image Nick Darnell ♦♦ STAFF Sep 26 '14 at 10:51 PM

Ah, you want a property of the class type that you can use for factoring and such.

 UPROPERTY(blah)
 TSubclassOf<MyClass> MyClassType;
avatar image Andrew Mac Sep 26 '14 at 10:52 PM

That's exactly what I was looking for! Thank you so much.

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question