Watch Pre-recorded Live Shows Here
Why Join
Become a member
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
C# Corner Home
Technologies
Monthly Leaders
ASK A QUESTION
Forum guidelines
johnwires
0
1
0
Constructors- Passing in values in and setting it up?
Feb 27 2005 6:34 AM
Hi guys, Im working on savings account program that the user inputs a interest rate and a balance. 1.)How would i set the initial interest rate and balance values zero? 2.)Would anyone know how to take the interest rate and balance values from the client class to my driver constructor class so i can modify them? I know you do something like : balance = balance_box.Text or something like that... right now i have this as my driver constructor class: using System; namespace project { ///
/// Summary description for SavingsAccount. ///
public class SavingsAccount { //creating private variables private double annualInterestRate, savingsAccountBalance; //defualt constructor setting values to zero public SavingsAccount() { SetAnnualInterestRate( 0 ); SetSavingsAccountBalance( 0 ); } //methods to set values to zero, but i did that above, or do i need these? public SavingsAccount(double annualInterestRate ) { SetAnnualInterestRate(0); } public SavingsAccount(double savingsAccountBalance ) { SetSavingsAccountBalance(0); } } }
Reply
Answers (
1
)
Using Reflection methods in VB to find design-time Property values
Reflection