Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login


19 May, 2024: Line wrapping has been changed to be more consistent with Usenet standards.
 If you find that it is broken please let me know here

devel / comp.lang.c++ / Re: a problem with an program

o Re: a problem with an programDavid Brown

Re: a problem with an program


  copy mid

  copy link   Newsgroups: comp.lang.c++
From: (David Brown)
Newsgroups: comp.lang.c++
Subject: Re: a problem with an program
Date: Sat, 30 Sep 2023 16:57:12 +0200
Organization: A noiseless patient Spider
Lines: 36
Message-ID: <uf9d08$uldu$>
References: <>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sat, 30 Sep 2023 14:57:13 -0000 (UTC)
Injection-Info:; posting-host="c330df27e0489197c4726651b144e5a3";
logging-data="1004990"; mail-complaints-to=""; posting-account="U2FsdGVkX19RfxnrPiIq8TfxJ8bUSKb3dlbFjfUB5z0="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Cancel-Lock: sha1:CHECC/PS5iGR6vFyzQ2HWzK+oiI=
Content-Language: en-GB
In-Reply-To: <>
 by: David Brown - Sat, 30 Sep 2023 14:57 UTC

On 29/09/2023 21:59, karam hello wrote:
> i have a problem with this program using C++ OOP inheritance specially on class c:
> #include <iostream>
> using namespace std;
> class a{
> private:
> string name;
> int age;
> public:
> a(string n, int a){
> name = n;
> age = a;
> }
> };
> class b{
> private:
> string email;
> public:
> b(string em){
> email = em;
> }
> };
> class c:public a, public b{
> public:
> c(string n, int a, string em) : a(n, a), b(em){}
> };
> int main(){
> c c1("k", 10, "com");
> }

It looks like you are learning the language. I recommend getting in the
habit of using good names for your classes (and everything else), rather
than "a" or "b". Good naming makes code easier to write, and vastly
easier to read, and you should practice it from the start, even for
simple test code. See if it helps you out here.

devel / comp.lang.c++ / Re: a problem with an program


rocksolid light 0.9.81
clearnet tor