473,406 Members | 2,956 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Method modifiers

1
Hi every bady
I need some help..

How to prevent a method being over-ridden?
How to require a method to be over-ridden?
How to call method from the super class?

If any one know help me Plz.
Thanks,
Mar 6 '07 #1
3 1161
sumittyagi
202 Expert 100+
Hi every bady
I need some help..

How to prevent a method being over-ridden?
How to require a method to be over-ridden?
How to call method from the super class?

If any one know help me Plz.
Thanks,
answer to your questions.
1.How to prevent a method being over-ridden?
just add the keyword 'final' in method declaration.

eg. public final void myMethod() { bla.. bla... bla... }

2. How to require a method to be over-ridden?
I am not getting what u want to ask here.
every method which is not declared final can be over-ridden.

3. How to call method from the super class?
an overridden method could be bypassed an the super method could be called by using super keyword; eg:- super.myMethod();
Mar 7 '07 #2
sicarie
4,677 Expert Mod 4TB
1.How to prevent a method being over-ridden?
just add the keyword 'final' in method declaration.

eg. public final void myMethod() { bla.. bla... bla... }
FYI - That'll get you most of the way, but there's still a workaround.
Mar 7 '07 #3
r035198x
13,262 8TB
2. How to require a method to be over-ridden?
Make it abstract?
Mar 7 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Laurence Nuttall | last post by:
What is the modifiers property of a label mean? I looked in the help, but couldn't find any explantion for it. Thanks in Advance, Laurence Nuttall Programmer Analyst III
3
by: kchalla | last post by:
Can anybody let me know the difference between public and private class access modifiers? Thanks in advance
5
by: kuvpatel | last post by:
Hi I want to refer a class called LogEvent, and use one of its methods called WriteMessage without actually having to create an instance of Logevent. I have tried using the word sealed with...
2
by: Bob Weiner | last post by:
Is it possible to create a property and specify different access modifiers for the get and set methods? From the property definition it appears that you can define attributes but not access...
4
by: Picho | last post by:
Hi all, Using reflection, I can invoke/call private methods of an object. is this intended? if yes, why? in what scenario (example would be good) should I be givven the option to use...
22
by: WXS | last post by:
Sometimes a method in a class requires the use of class instance variables/fields that will not be used outside of the method itself. Currently this means you must create a instance field in the...
26
by: Patient Guy | last post by:
The code below shows the familiar way of restricting a function to be a method of a constructed object: function aConstructor(arg) { if (typeof(arg) == "undefined") return (null);...
2
dmjpro
by: dmjpro | last post by:
why can't we use final, static, native, synchronized, private modifiers in abstract method ... explain me in details ... thanx in advance
13
by: Tom Baxter | last post by:
Hi everyone, Has anyone looked at section 18.1.1 of the C# spec? It indicates 'new' and 'protected' are valid modifiers on struct declarations. First, how can 'protected' be valid on a struct,...
9
dmjpro
by: dmjpro | last post by:
************************** Sorry the title would be Overriding. Please experts, correct the title ;) ************************** Method signature includes ... 1.Modifiers 2.Return type...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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...
0
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...
0
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...

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.