473,626 Members | 3,210 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

overwrite private method... (of wxColumnSorterM ixin class)

Is there a posibility to overwrite a private method (one that starts with
__ ) ? I read that they are just formely private, they are prefixed with the
class name to have an obtured visibility, so maybe it's a trick here...

More details...
I use wxPython, more specifically the wxColumnSorterM ixin class. I want to
overwrite the __OnColClick event handler to behave on my way: I want the
sorting feature will affect only some columns, not all columns and that
event handler is the key. The problem is that the event chain is skiped in
the __OnColClick method, so I cannot receive the event anymore. So, my idea
was to overwrite the __OnColClick method in the mixin subclass. Is this
possible? Or, are they other solutions for this ?

Thanks,
Florian.
Jul 18 '05 #1
2 2104

"Florian Preknya" <bo**@coco.ro > wrote in message
news:bu******** **@nebula.dnttm .ro...
Is there a posibility to overwrite a private method (one that starts with
__ ) ? I read that they are just formely private, they are prefixed with the class name to have an obtured visibility, so maybe it's a trick here...

More details...
I use wxPython, more specifically the wxColumnSorterM ixin class. I want to
overwrite the __OnColClick event handler to behave on my way: I want the
sorting feature will affect only some columns, not all columns and that
event handler is the key. The problem is that the event chain is skiped in
the __OnColClick method, so I cannot receive the event anymore. So, my idea was to overwrite the __OnColClick method in the mixin subclass. Is this
possible? Or, are they other solutions for this ?

Thanks,
Florian.

What you read is true, so far as I know. It is possible to override them,
as Python doesn't have a notion of encapsulation, again, as far as I know.
You can probably get away with this.
Jul 18 '05 #2
On Mon, Jan 19, 2004 at 05:00:03AM -0800, Zachary wrote:

"Florian Preknya" <bo**@coco.ro > wrote in message
news:bu******** **@nebula.dnttm .ro...
Is there a posibility to overwrite a private method (one that starts with
__ ) ? I read that they are just formely private, they are prefixed with

the
class name to have an obtured visibility, so maybe it's a trick here...

More details...
I use wxPython, more specifically the wxColumnSorterM ixin class. I want to
overwrite the __OnColClick event handler to behave on my way: I want the
sorting feature will affect only some columns, not all columns and that
event handler is the key. The problem is that the event chain is skiped in
the __OnColClick method, so I cannot receive the event anymore. So, my

idea
was to overwrite the __OnColClick method in the mixin subclass. Is this
possible? Or, are they other solutions for this ?

Thanks,
Florian.

What you read is true, so far as I know. It is possible to override them,
as Python doesn't have a notion of encapsulation, again, as far as I know.
You can probably get away with this.


Encapsulation is not the same thing as data hiding or private
attributes/methods. Python does not have private attributes or methods, so
this is possible. Python *does* support the concept of encapsulation, but
that is mostly unrelated to the question at hand.

class CustomColumnSor ter(wxColumnSor terMixin):
def _wxColumnSorter Mixin__OnColCli ck(...):
...

Assuming wxColumnSorterM ixin is subclassable, this will work. It may not
be, though. There is also probably a better way to achieve the results
you're looking for. Perhaps by specifying a callback in some other way,
such as binding a handler to an event.

Jp

Jul 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
3695
by: jcteague | last post by:
I have a class that has a set<int> member variable. the items in the set are selected indices of a vector. I would like to sort the set on the values in the vector they point too. Here is a part of the header file: Class A{ public: int getX(int i) //basic getter. gets value from vector private
14
2993
by: ericellsworth | last post by:
Hi, I'm trying to use a class to pass variables back and forth from a form opened in dialog mode. I have created a class which invokes a form in its show method, like so: Public Sub Show() ' This method shows the form used to get the info If sWhereInt = "" Then DoCmd.OpenForm sFormNameInt, acNormal, , , acFormAdd, _
4
1941
by: ewolfman | last post by:
Hi, I'm trying to retrieve a private method using reflection, which exists in my ASP.NET Page. It works only if I change the method's accessor to 'protected'. BTW: this occurs only for Page's private methods; if I create a new class within the page's file, it works fine. protected void Page_Load(object sender, EventArgs e)
7
1120
by: Charles Law | last post by:
Sorry, but I am on a bit of a roll today. I have just found that I can make a method private to my class, but then use AddHandler in an external class to hook it up. Is that what people would expect? For example <code> Public Interface IMyClass
7
3726
by: Alex Vinokur | last post by:
I tried to build program with partial implementation. However a linker generates errors. Is there any approach that enables to use partial implementation for similar purposes? ------ foo.cpp --- struct Base { virtual void foo1() = 0; virtual void foo2() = 0;
4
5776
by: rognon | last post by:
Hi there, I'm trying to do something, but I don't know if it's possible. Basically, I want to have a public static class method that could access a private object's method. I would like to be able to do : Class.method(InstanceOfClass); The method would then access a private function from Class by doing something like
8
5733
by: David Veeneman | last post by:
Should a member variable be passed to a private method in the same class as a method argument, or should the method simply call the member variable? For years, I have passed member variables to private methods in the same class as method arguments. For example, if Public method Foo() calls private method Bar(), and if Bar() uses member variable m_MyVariable, I declare the private method with the signature: private void Bar(SomeType...
6
3615
Xx r3negade
by: Xx r3negade | last post by:
Consider this: I have the class foo, with the public method thread(), and the private method bar() In the thread() method, I would like to create a new thread, using pthread_create(), that points to bar(). Could someone tell me how to do this? I have the following code: #include <iostream>
0
8265
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8196
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8705
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8637
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8504
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6125
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5574
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4197
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1511
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.