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
(this->deck).pop();
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:
Card.h
// 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"
UCLASS()
class CARDS_API ACard : public AActor
{
GENERATED_BODY()
public:
// Sets default values for this actor's properties
ACard();
protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;
public:
// Called every frame
//virtual void Tick(float DeltaTime) override; //Not needed, since the card remains pretty static
UPROPERTY(EditAnywhere)
int value;
void SetValue(int value);
};
Any help would be much appreciated