Deutsch English Français Italiano |
<35400604257703c65dff9e04e001868077a86801.camel@gmail.com> View for Bookmarking (what is this?) Look up another Usenet article |
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: wij <wyniijj5@gmail.com> Newsgroups: comp.lang.c++ Subject: Re: What is OOP? Date: Mon, 02 Dec 2024 16:27:46 +0800 Organization: A noiseless patient Spider Lines: 76 Message-ID: <35400604257703c65dff9e04e001868077a86801.camel@gmail.com> References: <d8a5a0d563f0b9b78b34711d12d4975a7941f53a.camel@gmail.com> <vijc0r$33fek$2@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Date: Mon, 02 Dec 2024 09:27:47 +0100 (CET) Injection-Info: dont-email.me; posting-host="4577dd8d25eca687854d0e4ae5cd6643"; logging-data="3366981"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/cwBoUWFNIZKNlN8xZt06I" User-Agent: Evolution 3.50.2 (3.50.2-1.fc39) Cancel-Lock: sha1:vLCQH5ui7jwGQXcTXzwZAbqiBXU= In-Reply-To: <vijc0r$33fek$2@dont-email.me> On Sun, 2024-12-01 at 20:11 -0800, Chris M. Thomasson wrote: > On 12/1/2024 9:17 AM, wij wrote: > > There are several understandings: > > https://www.quora.com/As-an-experienced-OOP-programmer-in-your-opinion-= whats-the-biggest-problem-of-OOP-object-oriented-programming > >=20 > > ... > > OO can have many meaning. I took OO to mean object, the basic entity of= the > > programming model and the operation of the object. The concept, as foun= dmental, > > has to be solid, practical and easily usable. Otherwise, more codes and= efforts > > will be needed latter to fix it, making the original goal ,practically,= a lie. > > IOW, (nearly) a flawless model is all the basics. ... > > https://sourceforge.net/projects/cscall/files/MisFiles/ClassGuidelines.= txt/download > [...] >=20 > struct object > { > =C2=A0=C2=A0=C2=A0=C2=A0 // [...] >=20 > =C2=A0=C2=A0=C2=A0=C2=A0 void do_it(); > =C2=A0=C2=A0=C2=A0=C2=A0 void wink(); > =C2=A0=C2=A0=C2=A0=C2=A0 void laugh(); > =C2=A0=C2=A0=C2=A0=C2=A0 void pose(); > }; >=20 >=20 > ? OOP right there in a sense? NOPE. Snippet from the classguidelines of libwy: .... Const member functions: A set of const function members, often referred to as property or attrib= ute members, defines whether or not two objects function 'identically'. In general, a minimum set of such members must exist. These members are oft= en in complexity O(1), and provide the basic proofs that the class is prope= rly designed. .... If there is no attribute members (const function member), how do we know wh= ether the class is properly designed or not? So, bascially, as long as default ct= or exists, there is a member 'bool is_default() const' to confirm it. The 2nd question is how do we know whether the copy constructor does its job? Then, there is a series of setters and getters... basically, verifiable by each o= ther. If you can make the function of these sets of members concise, efficient an= d consistent, the concept of the class in your brain is probably right, other= wise not right. This is the key point of libwy's OOP. With your example (lacks ctors, but important), what is 'do_it()' and others? You need some attribute members (getters) to confirm what those non-const members do are exactly what they claim doing. So you also need ot= her attributes e.g. is_wink(), is_laugh() and is_pose(). Then, what the copy ct= or should do is clear. Then, assignment operator...,etc. Whenever you have an idea, concept, try make it a 'complete' class (sometim= es=C2=A0 the idea does not fit as a class). Follow the basic rule, then, class desig= n, the program, will be lots easier and fun.