Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 24-11-2009
Member
 
Join Date: Mar 2009
Posts: 92
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
Reply With Quote
  #2  
Old 24-11-2009
Member
 
Join Date: May 2008
Posts: 2,293
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.
Reply With Quote
  #3  
Old 24-11-2009
Member
 
Join Date: Jan 2009
Posts: 199
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.
Reply With Quote
  #4  
Old 24-11-2009
Member
 
Join Date: Dec 2008
Posts: 177
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;}
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Redeclration a method of an object"
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


All times are GMT +5.5. The time now is 02:15 PM.