I took a button in form. I have two classes emp and bonus.bonus class is inherited from emp class. If bonus is giving ie in dialog box if we select ‘Yes’ b ie bonus is added to sal and we get ts ie total sal along with eno. If bonus is not given ie in dialog box if we select ‘No’ we need to get only sal along with eno.
The following pgm is working fine.
class emp { private int eno = 101; protected int sal = 5000; public void print() { MessageBox.Show("eno = " + eno.ToString() + " sal " + sal.ToString()); } } class bonus : emp { int b, ts; public void increment (int x) { b = x; print(); ts = sal + b; MessageBox.Show("ts =" + ts.ToString()); } }
private void button1_Click(object sender, EventArgs e) { DialogResult dr; dr = MessageBox.Show ("r u giving bonus", "peers", MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (dr == DialogResult.Yes) { bonus obj = new bonus(); obj.increment(3000); } else { emp x = new emp(); x.print(); } } }
But I want to give values as parameters
So I wrote the pgm as
class emp { private int eno; protected int sal; public emp(int x, int y) { eno = x; sal = y; } public void print() { MessageBox.Show("eno =" + eno.ToString() + "sal = " + sal.ToString()); } } class bonus : emp { private int b, ts; public bonus(int z) { b = z; //} int ts; ts = b + sal; print(); MessageBox.Show("ts = " + ts.ToString());
} } private void button1_Click(object sender, EventArgs e) { DialogResult dr; dr = MessageBox.Show("are u giving bonus", "peers", MessageBoxButtons.YesNo, MessageBoxIcon.None); if (dr == DialogResult.Yes) { emp x1 = new emp(101,5000); bonus obj = new bonus(3000); x1.print(); } else { emp x = new emp(101,5000); x.print(); } } }
Now Iam getting error as No overload for method 'emp' takes '0' arguments .How to solve this error
Actually my intension was to ask eno,sal and bonus at runtime and display the results accordingly when I press button which I took in form .how to ask them at runtime . Can u give me that code .
Interface contains the declaration of methods only and we can declare this method also inside our own class.So what is the need once declare a method inside the interface and then implement it into a class?
I took a button in form.I have two classes emp and bonus.bonus class is inherited from emp class.If bonus is giving ie in dialog box if we select ‘Yes’ b ie bonus
Latest Answer : Hi aarruunnaa,You try this code, if it is useful for you send me reply otherwise ask me again dont hesitate class emp {public int eno,sal; public emp(){}public emp(int eno,int sal) {this.eno=eno;this.sal=sal; }public virtual void print() {MessageBox.Show("eno ...
Object Oriented JavaScript In this chapter you ll learn about OOP Object Oriented Programming and how it relates to JavaScript As an ASP NET developer you probably have some experience working with objects and you may even be familiar with concepts such as inheritance However unless you re already a
Common Data Modeling is one of the core considerations when setting up a business data warehouse. Any serious company wanting to have a data warehouse will have to be first serious about data models. Building a data model takes time and it is not unusual for companies to spend two to five years just
SQL Programming Overview
Anybody who has done something for a long time has probably wanted to change how things work at some point or another. A worker at a mill might have found a more efficient way of cutting logs, or a mathematics teacher might have had a hand in changing a school’s al
If you want to create WinRunner scripts that are highly efficient, there are important programming concepts that you will want to become familiar with. Understanding these concepts will provide you with a large number of key benefits. In addition to understanding these concepts, you must also learn
IT Certification programs have several options that will offer you the best knowledge. By learning everything that you need to know about information technology you will be able to open new doors to your career and personal business desires.
IT Certification offers several vari
JavaScript Window Object Open Method Part 2 In this JavaScript tutorial you will learn about JavaScript Window Object Open Method features of window object open method scrollbars status titlebar toolbar top width innerHeight innerWidth outerHeight outerWidth and hotkeys mosgoogle center scrollbars S
JavaScript Window Object Open Method In this JavaScript tutorial you will learn about JavaScript Window Object Open Method features of window object open method channelmode directories dependent fullscreen screenX screenY height left location menubar resizable alwaysLowered alwaysRaised mosgoogle ce
Neuro linguistic Programming Methods There are several methods used for performing Neuro linguistic Programming on an individual for obtaining insights into the psyche of the person in order to correct to modify certain patterns of behavior These techniques are also used for Neuro linguistic trainin
The Difficult Past of Neuro linguistic programming Neuro linguistic programming has had a rocky past with a number of lawsuits rivalry unsystematic development and intermittent progress During the 1980s the two founders separated after the lawsuit filed by Bandler Bandler went on to file several law
History of Neuro linguistic programming Neuro Linguistic Programming NLP is a system co founded by John Grinder and Richard Bandler for bringing about personal development in any individual by interpreting and translating the human perception experience beliefs and language It was developed in early