Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I am messing with C# at the moment, I am after creating an account class which has a balance and an account holder. It also has methods to lodge, withdraw, getbalance, and getholdersName.

 

In the constructor section I have Account() and Account(string name, double balance) which should allow me to create a blank account or an account with existing data.

 

I have also set the lodge and withdraw method to be overrideable. I then created a class called AdvancedAccount that inherits from Account, that has a method that overrides the account.lodge method.

 

Everything works correctly from the main class if I go AdvancedAccount a = new AdvancedAccount();

 

I cannot however seem to create an account with which I can pass in the holders name and balance.

 

Any suggestions?

 

Mike55.

A Client refers to the person who incurs the development cost.

A Customer refers to the person that pays to use the product.

------

My software never has bugs. It just develops random features. (Mosabama vbforums.com)

  • *Experts*
Posted

What PD said. Here's a sample:

public class AdvancedAccount(string name, double balance) : base(name, balance)
{
// Nothing needed here - the call to base is done above
}

 

-ner

"I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...