473,387 Members | 1,641 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Question about call base class constructor

BlankHi, I am C# newbie , I have a class that inherit another class and I want to
call constructor of base class
I use:
base(parameter)... like this
but it doesn't work .
Need some help.
Regards
TA

Nov 16 '05 #1
2 1753
Hi,

You can use this:

public class BaseClass
{
public BaseClass(string parameter1)
{
}
}

public class DerivedClass : BaseClass
{
public DerivedClass(string parameter1) : base(parameter1)
{
}
}
Regards,
Paulo Gomes

"DreamTV" wrote:
BlankHi, I am C# newbie , I have a class that inherit another class and I want to
call constructor of base class
I use:
base(parameter)... like this
but it doesn't work .
Need some help.
Regards
TA

Nov 16 '05 #2
BlankThanks u guys
"DreamTV" <tr********@hotmail.com> wrote in message news:%2****************@tk2msftngp13.phx.gbl...
Hi, I am C# newbie , I have a class that inherit another class and I want to
call constructor of base class
I use:
base(parameter)... like this
but it doesn't work .
Need some help.
Regards
TA

Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: lok | last post by:
consider follow simple code: class Base { protected: int m_nAddr; public: Base(int addr_): m_nAddr(addr_) {} virtual ~Base() {} virtual int GetData() const = 0; };
8
by: Simon | last post by:
Hi everyone, Quick question: If I don't use base() in a subclass's construcor, will the base classes constructor be called at any point. It's just, I would have thought that the base class...
11
by: needin4mation | last post by:
I know this doesn't have much of a context, but, in this (take from Petzold's Programming Windows with C#) snippet: class DatePlus: Date { public DatePlus(){} public DatePlus(int year, int...
3
by: VJ | last post by:
Sorry this might really a very basic question.. not hitting me now...What am I doing wrong??? public class Textbox2 : Textbox1 { public Textbox2() --> gives a error No overload for method...
1
by: Chad | last post by:
I get the jist of this Inheritance stuff, I think, I'm just looking to understand better... I created a MustInherit base class with a constructor that had arguments. Within the constructor...
6
by: marcwentink | last post by:
Say I have class A that inherits from class B, and I call class A his constructor. Then somehow class B his constructor is called also. How does this work? Is a constructor under the hood a sort of...
9
by: Mike Hofer | last post by:
In a large application I'm working on (ASP.NET 1.1, VS2003), we have a base class that wraps stored procedures. Essentially, this base class (StoredProcedureBase) encapsulates the code to set up...
5
by: Amal P | last post by:
Dears, I have a question. class Data { }; class DisableDerive:virtual protected Data // A base class { private:
7
by: Daniel Jeffrey | last post by:
Hello, I am coming from Delphi and when I have a method in the inherited class, I call Inherited to call the base class method. This is handy cause you can control where and when these things...
6
by: Catherine Heathcote | last post by:
If I create a new class inherited from another with a constructor, what happens with the new class's constructer? Thanks for your time.
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...

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.