C# Programming - Inheritance - Discussion
Discussion Forum : Inheritance - General Questions (Q.No. 4)
4.
What will be the size of the object created by the following C#.NET code snippet?
namespace IndiabixConsoleApplication
{
class Baseclass
{
private int i;
protected int j;
public int k;
}
class Derived: Baseclass
{
private int x;
protected int y;
public int z;
}
class MyProgram
{
static void Main (string[ ] args)
{
Derived d = new Derived();
}
}
}
Discussion:
29 comments Page 3 of 3.
Vikas Verma said:
9 years ago
A size of int is 4.
How to check?
Console.WriteLine(sizeof(int));
Sol- 4
How to check?
Console.WriteLine(sizeof(int));
Sol- 4
Swathi said:
1 decade ago
Omprakash explained wrong way.
He counted 24 instead of 32.
He counted 24 instead of 32.
Varun Aggarwal said:
1 decade ago
How can we check the size of the objects? please reply asap.
Sridhar said:
7 years ago
Not getting this. Please explain in a correct way.
Sunil Verma said:
1 decade ago
How can we check the size of the objects?
Nandini Patil said:
1 decade ago
How can we check the size of objects?
Adi said:
10 years ago
How to check object memory?
Raghupati Gupta said:
10 years ago
How will value 24 Byte?
(1)
Nileema said:
1 decade ago
Can anybody explain it?
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers