|
|
![]() |
| Thread Tools | Search this Thread |
#1
| |||
| |||
Redeclration a method of an object
I want to know if it is possible to redefine a method of an object is to say that my class contains a function button onClick, but I want each instance of this object have its own function, and I wanted to know it is possible to redefine a method outside the class. If yes, how? Thank you in advance |
#2
| |||
| |||
Re: Redeclration a method of an object
The simplest use is to declare a named constant. To do this, one declares a constant as if it was a variable but add ‘const’ before it. References are also useful as function parameters. If you don't want the called function to be able to change the original object, you can declare the parameter to be a reference to a const object, and then the compiler will complain if the function tries to change it. |
#3
| |||
| |||
Re: Redeclration a method of an object
It is not possible to do that. You must be a class derived by different method, eg a class clBoutonAnnuler a clBoutonValider, etc ..., each derived from the Button class, and each with its specific onClick method. |
#4
| |||
| |||
Re: Redeclration a method of an object
Use / slots to connect to any external function on an event. This is better for (particular) events and graphical interfaces in C + +. Code: class Class1 { void Method1(); int MemberVariable1;} |
![]() |
|
Tags: c language, class, function, method, object |
Thread Tools | Search this Thread |
|
![]() | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Getting HP AIO Device object server register class object failed message on my system | Donoho | Hardware Peripherals | 6 | 06-06-2011 01:34 AM |
Scope of Object or variable in Object oriented Programming Languages | Dėfrim | Software Development | 3 | 08-01-2011 06:20 AM |
Passing object as a parameter in a method | Karumbu | Software Development | 4 | 06-01-2011 01:07 AM |
Javascript Replace function - Object doesn't support this property or method | Trini Alvarado | Software Development | 6 | 13-05-2010 12:11 PM |
Run time error:'1004': Method 'Range' of object '_Global' failed | 2muchreality | Software Development | 2 | 11-10-2008 02:46 PM |