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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

Abstract Method

Guys I wanted to create an abstract method; however, compiler gives me error. Is it not possible to create one or there is another way rather than the pure c++ coding(e.g. UFUNCTION(bla bla))?

Abstract Class:

 class THECLOUDGAME_API AGround : public AMovingPawn
     virtual TArray<AGround*> GetFollowingGrounds(void) = 0;


 1>C:\Users\ErayT\UnrealEngine\UnrealEngine_4.3\Engine\Source\Runtime\CoreUObject\Public\UObject\Class.h(2151): error C2259: 'AGround' : cannot instantiate abstract class
 1>          due to following members:
 1>          'TArray<AGround *,FDefaultAllocator> AGround::GetFollowingGrounds(void)' : is abstract
 1>          C:\Users\ErayT\Documents\Unreal Projects\TheCloudGame\Source\TheCloudGame\Elements/Grounds/Ground.h(23) : see declaration of 'AGround::GetFollowingGrounds'
 1>          C:\Users\ErayT\UnrealEngine\UnrealEngine_4.3\Engine\Source\Runtime\CoreUObject\Public\UObject\Class.h(2189) : see reference to function template instantiation 'void InternalConstructor<TClass>(const FPostConstructInitializeProperties &)' being compiled
 1>          with
 1>          [
 1>              TClass=AGround
 1>          ]
 1>          C:\Users\ErayT\Documents\Unreal Projects\TheCloudGame\Intermediate\Build\Win64\Inc\TheCloudGame\TheCloudGame.generated.cpp(30) : see reference to function template instantiation 'void GetPrivateStaticClassBody<AGround>(const TCHAR *,const TCHAR *,UClass *&,void (__cdecl *)(void))' being compiled

Product Version: Not Selected
more ▼

asked Aug 20 '14 at 07:08 PM in C++ Programming

avatar image

245 36 37 169

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

You can't use the C++ syntax for this because the Class Default Object gets instantiated. We usually use:

 virtual void MyFunc() { check(0 && "You must override this"); }

Compile time would be better but this works too

more ▼

answered Aug 20 '14 at 09:22 PM

avatar image

joeGraf STAFF
1.5k 35 12 69

avatar image ErayT Aug 21 '14 at 12:23 PM

Can you help me about the returning value?

In my example a TArray must be returned. Is there a trick not to return or how can I return a null value?

avatar image joeGraf STAFF Aug 21 '14 at 02:37 PM

Sorry, I missed that.

 virtual TArray<AGround*> MyFunc() { check(0 && "You must override this"); return TArray<AGround *>(); }
(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Another way:

 virtual TArray<int32> MyFunc()
     return TArray<int32>();

But no compile time support too.

more ▼

answered Apr 09 '18 at 07:31 AM

avatar image

8 3 8

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
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