Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 29th, 2008, 07:51 AM
Registered User
 
Join Date: Apr 2008
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Constructors

I have a classA with Privateconstructor and a method called addition
I have another classB with Protected Constructor and a method subtract

Ihave a classC with default constructor
Iam not abel to access methods of ClassA and ClassB

Please helpmeout


Madhuri
Reply With Quote
  #2 (permalink)  
Old April 29th, 2008, 07:54 AM
Friend of Wrox
 
Join Date: Mar 2007
Location: Hampshire, United Kingdom.
Posts: 432
Thanks: 0
Thanked 1 Time in 1 Post
Default

How about you help us out by actually showing us some of your code?

The most likely reason is that you have not declared your classes as public, and they are outside of each others scope..

Rob
http://robzyc.spaces.live.com
Reply With Quote
  #3 (permalink)  
Old April 29th, 2008, 08:11 AM
samjudson's Avatar
Friend of Wrox
Points: 8,687, Level: 40
Points: 8,687, Level: 40 Points: 8,687, Level: 40 Points: 8,687, Level: 40
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2007
Location: Newcastle, , United Kingdom.
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

Also, if class A and class B have private or protected constructors then you wont be able to create instances of them, so you'd need to mark the methods Addition and Subtract as static.

Show us some code, and explain why you have marked the constructors as private and protected will better help us work out what you should be doing.

/- Sam Judson : Wrox Technical Editor -/
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Constructors - instantiation brysora C# 2005 1 September 3rd, 2007 08:45 PM
Cascading Constructors rodmcleay General .NET 4 May 18th, 2007 03:57 AM
Private members in constructors shortt BOOK: Professional JavaScript for Web Developers ISBN: 978-0-7645-7908-0 2 May 16th, 2005 03:03 PM
COPY CONSTRUCTORS gbilios C++ Programming 4 April 30th, 2004 02:51 AM
Static Constructors Ibn_Aziz C# 3 December 25th, 2003 04:07 AM



All times are GMT -4. The time now is 07:51 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.