RMachnik
RMachnik

Reputation: 3684

C++/CLI generics compilation error

I have problem with compilation such files.

CardSet.h

#include "Card.h"
#pragma once
using namespace System;
using namespace Collections;


generic <typename  C>
public ref class CardSet<C> 
{
public:
    CardSet<C>();
};

CardSet.cpp

#include "CardSet.h"

generic <typename  C>
CardSet<C>::CardSet()
{
}

enter image description here I am following http://www.functionx.com/cppcli/classes2/Lesson24d.htm

Could sb advice what I am doing wrong?

Upvotes: 0

Views: 70

Answers (1)

Hans Passant
Hans Passant

Reputation: 941227

Well, follow the syntax that the tutorial demonstrates, you don't repeat <C> everywhere. Correct syntax is:

generic <typename C>
public ref class CardSet {
public:
    CardSet();
};

generic <typename C>
CardSet<C>::CardSet(){
}

Upvotes: 1

Related Questions