![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Generic Interface syntax in VS 2005 using Old syntax Hi All, Im using managed c++ syntax (VS 7) in VS 2005. And i want to implement a generic interface in it. But im getting errors when i try to compile the code. Here is what i want to do:- Like if you have following in C#:- public interface IFace<T> { void FuncA(T obj); } Then how to write it in managed c++. I tried with this:- generic<typename T> public __gc__interface IFace { public: void FuncA(T obj); } But im getting the following error:- error c2143: syntax error : missing ';' before '<' So, please let me know what is the issue here? Im assuming that we can implement generic interface in managed C++, since i have also used generic collections in the project as well....or my assumption is wrong? ![]() Thanks, Saad |
My System Specs![]() |
| | #2 (permalink) |
| | RE: Generic Interface syntax in VS 2005 using Old syntax 3 things: 1. I think for the 'old' syntax, you might need to use 'template', not 'generic'. 2. You need a space between "__gc" and "__interface". 3. You need a semi-colon to close the type. -- David Anton http://www.tangiblesoftwaresolutions.com Convert VB to C#, C++, or Java Convert C# to VB, C++, or Java Convert C++ to C#, VB, or Java Convert Java to C#, C++, or VB "Saad" wrote: Quote: > Hi All, > > Im using managed c++ syntax (VS 7) in VS 2005. And i want to implement > a generic interface in it. > But im getting errors when i try to compile the code. > > Here is what i want to do:- > Like if you have following in C#:- > > public interface IFace<T> > { > void FuncA(T obj); > } > > Then how to write it in managed c++. > I tried with this:- > > generic<typename T> > public __gc__interface IFace > { > public: > void FuncA(T obj); > } > > But im getting the following error:- > > error c2143: syntax error : missing ';' before '<' > > So, please let me know what is the issue here? > > Im assuming that we can implement generic interface in managed C++, > since i have also used generic collections in the project as > well....or my assumption is wrong? ![]() > > Thanks, > Saad > |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Help with syntax | PowerShell | |||
| "invalid STORE command syntax invalid message set syntax" | Vista mail | |||
| need syntax | Vista hardware & devices | |||
| AD DirectorySearcher Syntax | PowerShell | |||
| Syntax question | PowerShell | |||