![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Dec 2007
Posts: 11
Rep Power: 0
![]() |
Importing classes!
I am making a small program that will use the quadratic equation to solve a problem. I am suppose to make two separete classes, one to ask for input(main method) and the other to calcuate. So far I made both classes and wrote the code. However, I am having problems importing the second class and calling it! I know I have to write this import classname; but how do I call the class? so it can do its function.
Thx in advance. |
|
|
|
|
|
#2 |
|
Hobbyist Programmer
Join Date: Feb 2006
Posts: 214
Rep Power: 0
![]() |
Re: Importing classes!
If you've got 2 classes / 2 separate files. You'll be able to instantiate an instance of your calculate class (from within your other class) Done like so ->
Calculate calc = new Calculate(); Furthermore, if you want to call methods from that class you do int theValue = 0; theValue = calc.calculateIT();
__________________
Death smiles at us all. All a man can do is smile back. |
|
|
|
|
|
#3 |
|
Newbie
Join Date: Dec 2007
Posts: 11
Rep Power: 0
![]() |
Re: Importing classes!
Thanks alot, it works great!
|
|
|
|
|
|
#4 |
|
Hobbyist Programmer
Join Date: Feb 2006
Posts: 214
Rep Power: 0
![]() |
Re: Importing classes!
Not a problem. Good luck!
__________________
Death smiles at us all. All a man can do is smile back. |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Importing a file using VB | u2cannv | Visual Basic | 3 | Oct 22nd, 2007 2:48 PM |
| Importing a SWF into another Flash file | grimpirate | Other Web Development Languages | 0 | Sep 18th, 2006 12:35 AM |
| Importing from DLL's on Unix | Kaja Fumei | Existing Project Development | 5 | Jan 9th, 2006 6:35 PM |
| About importing your projects | 357mag | C++ | 8 | Apr 22nd, 2005 7:59 AM |