469,572 Members | 1,307 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,572 developers. It's quick & easy.

VC++ 2005 Beta 2: warning C4490: 'override' : incorrect use of override specifier

Hello.

After I converted my .net code to the new VC2005 syntax I started to get
C4490 on my ExpandableObjectConverter subclass overrides. The GetProperties
method is no longer called by the PropertyGrid when I use my subclass as a
type converter.

Can anyone tell me what has changed? What's the correct way to override
GetProperties method? Here's the code for my class:

// ExpandableProperty.h
#pragma once

using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Diagnostics;

public ref class TExpandableProperty : public ExpandableObjectConverter
{
public:
TExpandableProperty();

virtual PropertyDescriptorCollection^
GetProperties(ITypeDescriptorContext^, Object^, Attribute^ attributes)
override { return GetProperties(); }
virtual PropertyDescriptorCollection^ GetProperties(Object^) override {
return GetProperties(); }
virtual PropertyDescriptorCollection^
GetProperties(ITypeDescriptorContext^, Object^) override { return
GetProperties(); }
virtual PropertyDescriptorCollection^ GetProperties() override { return
propertyCollection; }

virtual bool GetPropertiesSupported(ITypeDescriptorContext^) override {
return true; }
virtual bool GetPropertiesSupported() override { return true; }

bool AddProperty(PropertyDescriptor ^propertyDescriptor);

private:
PropertyDescriptorCollection ^propertyCollection;
};

// ExpandableProperty.cpp

#include "StdAfx.h"
#include ".\expandableproperty.h"
#using <mscorlib.dll>

//-----------------------------------------------------------

TExpandableProperty::TExpandableProperty()
{
propertyCollection = gcnew PropertyDescriptorCollection(nullptr);
}

//-----------------------------------------------------------

bool TExpandableProperty::AddProperty(PropertyDescripto r^
propertyDescriptor)
{
propertyCollection->Add(propertyDescriptor);
return true;
}

Thanks in advance for any help.

Regards,
Adriano.

AltoQi - Tecnologia Aplicada Engenharia Adriano Coser Departamento de
Desenvolvimento Tel.: (48) 239-7000 ramal: 7069 e-mail: co***@altoqi.com.br
website: www.altoqi.com.br
Nov 17 '05 #1
2 3810
I think if you just override:

virtual PropertyDescriptorCollection^ GetProperties(ITypeDescriptorContext^,
Object^, array<Attribute^>^) override

and

virtual bool GetPropertiesSupported(ITypeDescriptorContext^) override

it'll take care of the overloads as well. Also, there isn't a
GetProperties() overload that takes no arguments.

"Adriano Coser" <coser@%removethis%altoqi.com.br> wrote in message
news:Oc*************@TK2MSFTNGP09.phx.gbl...
Hello.

After I converted my .net code to the new VC2005 syntax I started to get
C4490 on my ExpandableObjectConverter subclass overrides. The
GetProperties method is no longer called by the PropertyGrid when I use my
subclass as a type converter.

Can anyone tell me what has changed? What's the correct way to override
GetProperties method? Here's the code for my class:

// ExpandableProperty.h
#pragma once

using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Diagnostics;

public ref class TExpandableProperty : public ExpandableObjectConverter
{
public:
TExpandableProperty();

virtual PropertyDescriptorCollection^
GetProperties(ITypeDescriptorContext^, Object^, Attribute^ attributes)
override { return GetProperties(); }
virtual PropertyDescriptorCollection^ GetProperties(Object^) override {
return GetProperties(); }
virtual PropertyDescriptorCollection^
GetProperties(ITypeDescriptorContext^, Object^) override { return
GetProperties(); }
virtual PropertyDescriptorCollection^ GetProperties() override { return
propertyCollection; }

virtual bool GetPropertiesSupported(ITypeDescriptorContext^) override {
return true; }
virtual bool GetPropertiesSupported() override { return true; }

bool AddProperty(PropertyDescriptor ^propertyDescriptor);

private:
PropertyDescriptorCollection ^propertyCollection;
};

// ExpandableProperty.cpp

#include "StdAfx.h"
#include ".\expandableproperty.h"
#using <mscorlib.dll>

//-----------------------------------------------------------

TExpandableProperty::TExpandableProperty()
{
propertyCollection = gcnew PropertyDescriptorCollection(nullptr);
}

//-----------------------------------------------------------

bool TExpandableProperty::AddProperty(PropertyDescripto r^
propertyDescriptor)
{
propertyCollection->Add(propertyDescriptor);
return true;
}

Thanks in advance for any help.

Regards,
Adriano.

AltoQi - Tecnologia Aplicada $B!&(BEngenharia Adriano Coser Departamento de
Desenvolvimento Tel.: (48) 239-7000 ramal: 7069 e-mail:
co***@altoqi.com.br website: www.altoqi.com.br

Nov 17 '05 #2
Thanks for your answer James.

Translating from de old syntax I declared the third parameter as
'Attribute^' instead of 'array<Attribute^>^' and I just didn't see this
error until your answer.

Regards,
Adriano.

AltoQi - Tecnologia Aplicada Engenharia Adriano Coser Departamento de
Desenvolvimento Tel.: (48) 239-7000 ramal: 7069 e-mail: co***@altoqi.com.br
website: www.altoqi.com.br
"James Park" <jp**********@SpaMMEhotmail.com> escreveu na mensagem
news:%2****************@TK2MSFTNGP09.phx.gbl...
I think if you just override:

virtual PropertyDescriptorCollection^
GetProperties(ITypeDescriptorContext^, Object^, array<Attribute^>^)
override

and

virtual bool GetPropertiesSupported(ITypeDescriptorContext^) override

it'll take care of the overloads as well. Also, there isn't a
GetProperties() overload that takes no arguments.

"Adriano Coser" <coser@%removethis%altoqi.com.br> wrote in message
news:Oc*************@TK2MSFTNGP09.phx.gbl...
Hello.

After I converted my .net code to the new VC2005 syntax I started to get
C4490 on my ExpandableObjectConverter subclass overrides. The
GetProperties method is no longer called by the PropertyGrid when I use
my subclass as a type converter.

Can anyone tell me what has changed? What's the correct way to override
GetProperties method? Here's the code for my class:

// ExpandableProperty.h
#pragma once

using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Diagnostics;

public ref class TExpandableProperty : public ExpandableObjectConverter
{
public:
TExpandableProperty();

virtual PropertyDescriptorCollection^
GetProperties(ITypeDescriptorContext^, Object^, Attribute^ attributes)
override { return GetProperties(); }
virtual PropertyDescriptorCollection^ GetProperties(Object^) override
{ return GetProperties(); }
virtual PropertyDescriptorCollection^
GetProperties(ITypeDescriptorContext^, Object^) override { return
GetProperties(); }
virtual PropertyDescriptorCollection^ GetProperties() override { return
propertyCollection; }

virtual bool GetPropertiesSupported(ITypeDescriptorContext^) override
{ return true; }
virtual bool GetPropertiesSupported() override { return true; }

bool AddProperty(PropertyDescriptor ^propertyDescriptor);

private:
PropertyDescriptorCollection ^propertyCollection;
};

// ExpandableProperty.cpp

#include "StdAfx.h"
#include ".\expandableproperty.h"
#using <mscorlib.dll>

//-----------------------------------------------------------

TExpandableProperty::TExpandableProperty()
{
propertyCollection = gcnew PropertyDescriptorCollection(nullptr);
}

//-----------------------------------------------------------

bool TExpandableProperty::AddProperty(PropertyDescripto r^
propertyDescriptor)
{
propertyCollection->Add(propertyDescriptor);
return true;
}

Thanks in advance for any help.

Regards,
Adriano.

AltoQi - Tecnologia Aplicada $B!&(BEngenharia Adriano Coser
Departamento de Desenvolvimento Tel.: (48) 239-7000 ramal: 7069 e-mail:
co***@altoqi.com.br website: www.altoqi.com.br


Nov 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by John Gabriel | last post: by
20 posts views Thread by Nemanja Trifunovic | last post: by
1 post views Thread by Peted | last post: by
reply views Thread by suresh191 | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.