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"

Can't create a new Card class using assignment operator

Hey, I'm new to Unreal 4, and I'm trying to make a shuffling deck of cards as a first project. I'm trying to use the assignment operator to get the top card of the deck (which stores cards in a std::stack), but there's something about the assignment operator that I don't know how to fix. The code in Deck.cpp that's causing an error is:

 //Draw a card by removing the top of the deck. Return the drawn card
 ACard ADeck::Draw()
     ACard drawnCard;
     drawnCard = (this->deck).top(); //Problematic line
     return drawnCard;

The error I get is: Severity Code Description Project File Line Suppression State Error (active) E0330 "ACard &ACard::operator=(const ACard &)" (declared at line 12 of "e:\Programs\Epic Games\Projects\Cards\Source\Cards\Card.h") is inaccessible Cards e:\Programs\Epic Games\Projects\Cards\Source\Cards\Deck.cpp 42

I haven't overloaded the operator myself, since it's not in my source code:


 // Fill out your copyright notice in the Description page of Project Settings.
 #pragma once
 #include "CoreMinimal.h"
 #include "GameFramework/Actor.h"
 #include "Card.generated.h"
 class CARDS_API ACard : public AActor
     // Sets default values for this actor's properties
     // Called when the game starts or when spawned
     virtual void BeginPlay() override;
     // Called every frame
     //virtual void Tick(float DeltaTime) override; //Not needed, since the card remains pretty static
     int value;
     void SetValue(int value);

Any help would be much appreciated

Product Version: UE 4.17
more ▼

asked Sep 17 '17 at 03:52 AM in C++ Programming

avatar image

1 1 1 2

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

0 answers: sort voted first
Be the first one to answer this question
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