473,771 Members | 2,406 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

abstract class with parameterized constructor

2 New Member
Hi,

As i have one Abstract base class say MyBase.
It have parameterized constructor with string value it have abstract method call.
And I also have One child class say MyChild.
It does not have any constructor only one have public method and i want to call that parameterized constructor of base class onto child class.

Please give me solution accordingly...
Jul 27 '12 #1
1 2947
Frinavale
9,735 Recognized Expert Moderator Expert
Check out this link about Using Constructors and this link about Instance Constructors (C# Programming Guide).

You could just initialize your base class members from the constructor in the derived class.
Jul 27 '12 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

15
2415
by: Tee | last post by:
Hi, I have a base usercontrol with a method (blank method, no code), I have another few usercontrols that will inherit this base usercontrol, but I want to force all the usercontrol that inheriting this base usercontrol to override the method with its own code. How do I do it? I have tried to make the base usercontrol an abstract class (mustinherits + mustoverrides), this works, but all the usercontrols that inherit it will not able...
5
1881
by: S. Levent Yilmaz | last post by:
Is it possible to have the constructor in an interface call member functions polymorphically? For instance: ============================== // INTERFACE CLASS class SomeInterface { public: virtual void foo()=0; SomeInterface() { foo();} };
16
3527
by: Merlin | last post by:
Hi Been reading the GOF book and started to make the distinction between Class and Interface inheritance. One question though: Do pure abstract classes have representations? (data members?) What about abstract classes? Should abstract classes have a destructor and or constructor? What about pure abstract classes?
7
1796
by: vsgdp | last post by:
I have an abstract class A: class A { public: A(){ f(); } virtual void f() = 0; }; class B : public A
7
1737
by: erin.sebastian | last post by:
Hello Everyone, This is my first attempt at coding using an abstract class and i am getting an error i can't figure out. Here is the back ground. I have a project that contains an abstract class, it's namespace is CIG.Intranet.Commons.User and it has 2 methods in it public abstract getPropertiesHash (string userName) and public abstract getPropertiesXml (string userName) adn the class name is called CPUser.cs
17
3575
by: baibaichen | last post by:
i have written some code to verify how to disable slicing copy according C++ Gotchas item 30 the follow is my class hierarchy, and note that B is abstract class!! class B { public: explicit B(INT32 i =0):i_(i){} virtual ~B(){}
1
2091
by: Peter | last post by:
Hi, When I update/add a new web reference to a web service class with a parameterized constructor, what is preventing the generated proxy from including a definition for the parameterized constructor as well as the parameterless one? Regards, Peter
2
2269
by: talkingpidgin | last post by:
I am trying to figure out why it is not conventional to use protected constructors in abstract classes since the only time they should be called is by the constructors of it's derived classes. Is it simply because it's not strictly necessary since an abstract class can't be instantiated anyways? It just seems like it would be clearer to make the ctor protected so I figured there must be some reason for it. Also I am trying to put...
5
2203
by: Sathyaish | last post by:
/* I am writing this C# program because I forgot the syntax for calling a parameterized constructor from a non-parameterized one within the same class. I was coding in Java and just typed it like this: public MyClass(String someParam) { }
4
2064
by: Pranav | last post by:
Hello All, I have a simple question regarding the definition of abstract class, IIRC , Abstract class is one which contains virtual function declaration and other variables and no object of this class is created directly. If this is the case why don't we hide the constructor of abstract class into protected region? So that only object which inherits it can call the ctor of abstract class. In this way no one can create the object of...
0
9454
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10103
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9911
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8934
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7460
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4007
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3609
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2850
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.