First off, you should think more modularly; don't have the method accept the StreamReader, have it accept an IEnumerable of strings.
Secondly, don't have it accept the Dictionary and return void; have it return the Dictionary.
You are right in all but in this case I am creating multiple controls from the same user control. The user control has just one txtFirstName but when users sets total_adults=5 in Form1 then five txtFirstName controls will be created on the Form2
Thats why I am asking how can I change the property class to return the value and from Form2 I need when clicking Save to save read the value of all fives txtFirstName controls.
Hi, I have made a program to compare the pages of 2 books using the overloading concept. But i m not sure that is correct or not. Please see my code and tell me whether my program is logically correct or not based on the concept..
Hey rob, i thought better to compare the no. of pages of the books .. But if i compile this it wont print the message.( I m new to this overloading concept). What do you suggest how it should be then ??
As Rob has said, deriving from a base class specialises something - a book does not derive from a previous book except when it is an expanded version: the Directors Cut if you like.
Think about it: a "Book by Charlotte Bronte" derives from "Book", and so does a "Book by Terry Pratchett" - but that is pretty much the only thing they have in common: the elements which are common to all books (Pages, a cover, a title, an author) and so forth.
You wouldn't overload a method to get a number of pages from two different books, because the number of pages is a property of the individual instance on the book. But... you might overload it to get different information which is also instance specific:
This has two overloaded GetPages methods.
If you don't supply any parameters it returns the number of pages in the book.
If you pass it an integer, it returns the pages in that chapter.
The type of the parameter determines which version of the method gets called, and thus what the method does.
Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952)
Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)
Last Visit: 31-Dec-99 18:00 Last Update: 3-Oct-23 23:20