Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / July 2005

Tip: Looking for answers? Try searching our database.

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

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Adriano Coser - 27 Jul 2005 14:56 GMT
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(PropertyDescriptor^
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: coser@altoqi.com.br
website: www.altoqi.com.br 
James Park - 28 Jul 2005 00:15 GMT
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.

> Hello.
>
[quoted text clipped - 70 lines]
> Desenvolvimento Tel.: (48) 239-7000 ramal: 7069 e-mail:
> coser@altoqi.com.br website: www.altoqi.com.br
Adriano Coser - 28 Jul 2005 13:51 GMT
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: coser@altoqi.com.br
website: www.altoqi.com.br
>I think if you just override:
>
[quoted text clipped - 83 lines]
>> Departamento de Desenvolvimento Tel.: (48) 239-7000 ramal: 7069 e-mail:
>> coser@altoqi.com.br website: www.altoqi.com.br

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.