Just looking for confirmation: the only type of class interitance in C# is
public, right?
I can't find anywhere in the docs where this is explicitly stated. But I'm
assuming they've abandoned the complexities of C++ private inheritance.
This certainly doesn't work:
public class Tester : private MyBase {}
Thanks,
John 7 15921
John,
You are right, public inheritance is the only kind supported in C#.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"John Sparrow" <js************@nojunKecclescollege.ac.uk> wrote in message
news:u9*************@tk2msftngp13.phx.gbl... Just looking for confirmation: the only type of class interitance in C# is public, right?
I can't find anywhere in the docs where this is explicitly stated. But I'm assuming they've abandoned the complexities of C++ private inheritance.
This certainly doesn't work:
public class Tester : private MyBase {}
Thanks,
John
Dont know if this is what you're after but you dont
specify the level of access when inheriting.
Eg:
public class MyClass1: MyClass2
{
}
I have never seen it specified anywhere that you can't
inherit from private classes. To be honest I haven't tried
it, but i'm sure this will help if your query is purely
syntax based.
jax -----Original Message----- Just looking for confirmation: the only type of class
interitance in C# ispublic, right?
I can't find anywhere in the docs where this is
explicitly stated. But I'massuming they've abandoned the complexities of C++
private inheritance. This certainly doesn't work:
public class Tester : private MyBase {}
Thanks,
John
.
My bad, listen to Nick, he's cleverer then I. -----Original Message----- Dont know if this is what you're after but you dont specify the level of access when inheriting.
Eg:
public class MyClass1: MyClass2 { }
I have never seen it specified anywhere that you can't inherit from private classes. To be honest I haven't
triedit, but i'm sure this will help if your query is purely syntax based.
jax
-----Original Message----- Just looking for confirmation: the only type of class interitance in C# ispublic, right?
I can't find anywhere in the docs where this is explicitly stated. But I'massuming they've abandoned the complexities of C++ private inheritance. This certainly doesn't work:
public class Tester : private MyBase {}
Thanks,
John
.
.
Jax,
Not really. I just get lucky sometimes.
The original poster wanted to do something different though. He/she/it
wanted to derive in a private manner, meaning that by default, all members
of the base class are private/protected, as opposed to them being exposed
publically.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"Jax" <an*******@discussions.microsoft.com> wrote in message
news:05****************************@phx.gbl... My bad, listen to Nick, he's cleverer then I.
-----Original Message----- Dont know if this is what you're after but you dont specify the level of access when inheriting.
Eg:
public class MyClass1: MyClass2 { }
I have never seen it specified anywhere that you can't inherit from private classes. To be honest I haven't triedit, but i'm sure this will help if your query is purely syntax based.
jax
-----Original Message----- Just looking for confirmation: the only type of class interitance in C# ispublic, right?
I can't find anywhere in the docs where this is explicitly stated. But I'massuming they've abandoned the complexities of C++ private inheritance. This certainly doesn't work:
public class Tester : private MyBase {}
Thanks,
John
.
.
"It"????? grin.
I remember debates when I was a C++ programmer about the value (or lack of)
of private inheritance - as opposed to a private member object.
I used to think C++ was really cool... until I worked on a project where a
guy had overloaded all the operators to make + and - do totally bizarre, and
unintuitive, things! (ok, that's still possible with C#, but I live in
hope...grin).
I still think C++ is a great language, but it does tend to encourage
intellectual masturbation...
Thanks for the clarification,
John
(*he*!)
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:ON**************@TK2MSFTNGP09.phx.gbl... Jax,
Not really. I just get lucky sometimes.
The original poster wanted to do something different though.
He/she/it wanted to derive in a private manner, meaning that by default, all members of the base class are private/protected, as opposed to them being exposed publically.
Even C# is subject to bizarre programming styles, lol...
and the whole "IT" thing... maybe its the "IT"s that are overloading
operators with unintuitive usage...
--
Eric Newton
C#/ASP Application Developer http://ensoft-software.com/ er**@cc.ensoft-software.com [remove the first "CC."]
"John Sparrow" <js************@nojunKecclescollege.ac.uk> wrote in message
news:ug***************@TK2MSFTNGP11.phx.gbl... "It"????? grin.
I remember debates when I was a C++ programmer about the value (or lack
of) of private inheritance - as opposed to a private member object.
I used to think C++ was really cool... until I worked on a project where a guy had overloaded all the operators to make + and - do totally bizarre,
and unintuitive, things! (ok, that's still possible with C#, but I live in hope...grin).
I still think C++ is a great language, but it does tend to encourage intellectual masturbation...
Thanks for the clarification,
John (*he*!)
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote
in message news:ON**************@TK2MSFTNGP09.phx.gbl... Jax,
Not really. I just get lucky sometimes.
The original poster wanted to do something different though. He/she/it wanted to derive in a private manner, meaning that by default, all
members of the base class are private/protected, as opposed to them being
exposed publically.
That's right John. C# only supports public inheritance.
Pablo Cibraro
Lagash Systems www.lagash.com
"John Sparrow" <js************@nojunKecclescollege.ac.uk> wrote in message
news:u9*************@tk2msftngp13.phx.gbl... Just looking for confirmation: the only type of class interitance in C# is public, right?
I can't find anywhere in the docs where this is explicitly stated. But I'm assuming they've abandoned the complexities of C++ private inheritance.
This certainly doesn't work:
public class Tester : private MyBase {}
Thanks,
John
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Dave Theese |
last post by:
Hello all,
The example below demonstrates proper conformance to the C++ standard.
However, I'm having a hard time getting my brain around which language rules
make this proper...
The error...
|
by: seesaw |
last post by:
Compared to "public",
how does "private/protected" in inheritance change relationship between
classes
what is the purpose to define constructor as "private/protected"?
is there any usage to...
|
by: Ioannis Vranos |
last post by:
May someone explain why does this compile?
class HiddenSealBaseClass
{
public:
HiddenSealBaseClass() { }
};
class Sealed: virtual HiddenSealBaseClass
|
by: MJ |
last post by:
Hi
I have a following sample code
class base and class derived.
I have inherited the base class as private and tried to compile the
code its giving an error
"conversion from 'class derived *' to...
|
by: Tony Johansson |
last post by:
Hello!
Private inheritance is sometimes called implementation inheritance.
If you use this private inheritance how is with the usage of overriding
then.
Is overriding used less often when...
|
by: __PPS__ |
last post by:
Hello everybody, today I had another quiz question
"if class X is privately derived from base class Y what is the scope of
the public, protected, private members of Y will be in class X"
By...
|
by: karthikbalaguru |
last post by:
Hi,
Could someone here tell me some links/pdfs/tutorials to know about the
difference between Private Inheritance and Public Inheritance ?
I am unable to get info w.r.t it.
Thx in advans,...
|
by: puzzlecracker |
last post by:
The statement is taken from FAQ . What about non-virtual
functions? Can they be overriden? I still don't see a good
justification to prefer private inheritance over composition. In
fact, I have...
|
by: PragueExpat |
last post by:
I (think) that I've come up with a pattern that I haven't seen in any
publications so far and I would like some feedback. Basically, I was
looking for a way to inherit private functions and I came...
|
by: zhangyefei.yefei |
last post by:
i read book <effective c++>,it tell me that public inheritance means
is-a ,and private inheritance means is-implemented-in-terms-of.
but today i am puzzled by some strange codes.
the...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
| |