From: Charles Krug Newsgroups: comp.os.msdos.djgpp Subject: Re: first class Date: Fri, 13 Nov 1998 17:04:06 -0500 Organization: Pentek Corporation Lines: 73 Message-ID: <364CACD6.A92DD4D8@mail.pentek.com> References: <364C768F DOT BF94B96A AT nceye DOT net> NNTP-Posting-Host: mail.pentek.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 4.5 [en] (WinNT; U) X-Accept-Language: en To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com sabrh wrote: > Hya, > yes, this is my first class. > I'm a freshman and CS minor. You've all the sympathy I can muster. > It wasn't an assignment to write a class. > I ve done assignment without classes, but wanted try classes. Well, it > works, but it gives me warning (gcc)that functions containing for are > not expanded inline. Functions defined in the class (the DO SOMTHING in the class) are inline by default, IIRC, though I may be wrong about this. This is opposed to functions that merely are DECLARED in the class, with the definition elsewhere. Usually with classes, you make two files. 1: myclass.h --everything you need to know to use the class 2:myclass.c --the gory details of the implementation gcc is warning you that it expects something fast and small, but instead found looping constructions, that can be arbitrarily large, so aren't elegible for "inlining." It shouldn't affect operation, assuming that everything else is correct. > I was reading bout inlining functions, but can't see how can I apply it > here? > Any explanations will be greatly appreciated. > Also, when I link in graphics.lib it messes up int convertions....What's > the solution.. graphics.lib isn't part of djgpp. You want Allegro, but you need to learn quite a bit more before you can use it. If you read Stroustrup, and I encourage you to, you will find a reasonable definition of OOP--decide what data you need to look at, and create methods that do this. A better structure for Dorit would be to have a constructor that takes a string (you have no constructor) and assigns it to "line", or perhaps an assignment operator (=) that assigns dorit::line from a string. Then the method dorit::thinking can take the character to search for as input. The resulting main() looks like this: main() { Dorit blushing; char Mystring[80], lookfor; cin >> Mystring; blushing = Mystring; // call the assignment operator for dorit // Get the char to search for blushing.thinking(lookfor); } Good luck charles -- Charles Krug, Jr. Application Engineer Pentek Corp 1 Park Way Upper Saddle River, NJ 07458