#using<System.dll>
usingnamespace System;
usingnamespace System::Diagnostics;
refclass B {
public:
virtual void F() { 
Console::WriteLine("B::F");
}
};
refclass D : B {
public:
virtual void F() override {
Console::WriteLine("D::F");
}
};
int main(){
B^ b = gcnew D;
b-F();
}

It says identifer not found.
I dont know why it thinks that , Probaly a simple mistake any ones see anything?

------ Build started: Project: c++ test, Configuration: Debug Win32 ------
Compiling...
test2.cpp
.\test2.cpp(22) : error C2143: syntax error : missing ';' before '-'
.\test2.cpp(22) : error C3861: 'F': identifier not found
Build log was saved at "file://c:\Documents and Settings\kcd\My Documents\Visual Studio 2005\Projects\c++ test\c++ test\Debug\BuildLog.htm"
c++ test - 2 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

>usingnamespace
I'm reasonably sure you need a space between those two keywords. :)

Actually, you have tons of similar syntax errors. This compiles:

#using<System.dll>

using namespace System;
using namespace System::Diagnostics;

ref class B {
public:
  virtual void F(){
    Console::WriteLine("B::F");
  }
};
ref class D : B {
public:
  virtual void F() override {
    Console::WriteLine("D::F");
  }
};
int main(){
  B^ b = gcnew D;
  b->F();
}

>It keeps changing my code.
Can you be more specific?

I posted a image of my code.

I posted a image of my code.

So I see. But I don't understand what you mean by "It keeps changing my code". You have one syntax error in the image you posted, and that's using b-F(); instead of b->F();. Notice the missing angle bracket that completes the arrow operator. Beyond that, I have no idea what you're trying to ask. :(

HAhha that helps a ton i knew it was somthing simple.

When i try to put code on forum it changes it.
with [ code ]

>When i try to put code on forum it changes it.
Ah, gotcha. I thought you were talking about Visual Studio. :lol: Anyway, the single biggest culprit when it comes to formatting is tabs. If you use tabs instead of spaces for indentation, they may not be translated correctly when posting code.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.