Wrox Programmer Forums
|
BOOK: Beginning C# 3.0 : An Introduction to Object Oriented Programming ISBN: 978-0-470-26129-3
This is the forum to discuss the Wrox book Beginning C# 3.0 : An Introduction to Object Oriented Programming by Jack Purdum; ISBN: 9780470261293
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning C# 3.0 : An Introduction to Object Oriented Programming ISBN: 978-0-470-26129-3 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 27th, 2009, 01:47 AM
Registered User
 
Join Date: Oct 2009
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Help on Class Design

Hi! I am new to OOP and about half way through the book. I was just starting to grasp the concept of class design and I'm running into an issue. I don't know whats wrong. I'm referring to Chapter 9 - Part 3 - Writing your own classes. I wrote the clsDates class and on p 230 where I'm trying to instantiate a clsDates object named myDate and am getting the following error: The type or namespace name 'clsDates' could not be found (are you missing a using directive or an assembly reference?). I am comparing my code to yours and it identical! I am really trying hard to figure out what I'm doing wrong...Can you help??
Thanks for your time!
 
Old October 29th, 2009, 07:57 AM
Friend of Wrox
 
Join Date: Sep 2008
Posts: 234
Thanks: 0
Thanked 32 Times in 30 Posts
Default Class design issue

Without actually seeing your code, my best guess is that you do not have the class code included in the project. The code you see starting on page 225 must be included in your project's namespace. Otherwise, VS doesn't know where to look for the class. Make sure that code is in the proper template type (i.e., class). See page 209 and make sure you place the class code in a class template in your project. That should take care of it.
__________________
Jack Purdum, Ph.D.
Author: Beginning C# 3.0: Introduction to Object Oriented Programming (and 14 other programming texts)
 
Old October 29th, 2009, 09:40 AM
Registered User
 
Join Date: Oct 2009
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for the response, I truly appreciate it. I will try this is hopefully it corrects the issue. So, I when I create the classDesign project I need to add a class file and add the clsDates code to that page? Is there anything else I need to do to make that clsDates class visible to VB? Also in the future when I want to instantiate a clasDates object from another program I am writing, do I also have to add a class file and include the code for clsDates or will VB know where how to access it if I just say clsDates myDate = new clsDates();?
Thanks again for your help, it is greatly appreciated. And I really love the book, it's definitely the best material out there.
 
Old October 29th, 2009, 12:57 PM
Friend of Wrox
 
Join Date: Sep 2008
Posts: 234
Thanks: 0
Thanked 32 Times in 30 Posts
Default Class code files

Yes, you will need to include the class code in any project that uses it. Once VS sees the the source code file in the project, it has no problem finding references to it.

After you get a little experience, you can learn how to compile the class into a Dynamic Link Library (DLL) file and then just add a reference to it to your project, just like you for the standard Windows library references...but that's another topic.
__________________
Jack Purdum, Ph.D.
Author: Beginning C# 3.0: Introduction to Object Oriented Programming (and 14 other programming texts)
 
Old October 29th, 2009, 12:57 PM
Friend of Wrox
 
Join Date: Sep 2008
Posts: 234
Thanks: 0
Thanked 32 Times in 30 Posts
Default Class code files

Yes, you will need to include the class code in any project that uses it. Once VS sees the the source code file in the project, it has no problem finding references to it.

After you get a little experience, you can learn how to compile the class into a Dynamic Link Library (DLL) file and then just add a reference to it to your project, just like you for the standard Windows library references...but that's another topic.
__________________
Jack Purdum, Ph.D.
Author: Beginning C# 3.0: Introduction to Object Oriented Programming (and 14 other programming texts)
 
Old October 29th, 2009, 04:51 PM
Registered User
 
Join Date: Oct 2009
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Well that certainly clears up alot. Thanks for your help, I'm glad I decided to post.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Class design in Java code_lover BOOK: Beginning Java 2 1 November 14th, 2011 06:43 PM
Question about Class Design absolutezero C# 2008 aka C# 3.0 1 January 22nd, 2009 11:22 AM
class design jay.net General .NET 3 April 13th, 2007 07:59 AM
C# Class Design Handbook dchernin All Other Wrox Books 9 December 20th, 2004 09:02 AM
Class Design Info... kaizer BOOK: Beginning Java 2 1 December 27th, 2003 06:49 AM





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