Why c is preferred over Java for embedded system?
Embedded systems typically run on extremely limited hardware. Even the smallest implementation of Java (Micro Edition) can't compete with a small C implementation both in terms of memory footprint and execution speed.
What is the major difference in class and interface in c?
The implementation detail. Classes may provide a default implementation, interfaces provide only the method signatures
What are the advantages and disadvantages of arrays in c sharp?
Advantages:
1. Can store "n" number of same data types in different indexes
2. Can be accesses using reference.
Disadvantage:
1. No boundary check, if the array boundary is crossed run time
2. No facility to increase the size of array in Run time
When do you give preference to abstract classs and interface?
Abstract class provides a way of "being a [something like me]", or inheritance
interface provides a set of functionality (contract) as "behaving".
Abstract class provides the single inheritance and perhaps some default implementation, while interface may be implemented by different classes that have nothing to do one and other except the common interface implementation.
The preference I would start with:
Ask yourself that an object should be "Is a something or behave like something". If your answer is "Is a", then abstract class is more likely your good choice. But if your answer is behave like, does not need to Is a, then the interface is the way to go.
How do you convert a doc file into a pdf file using C sharp code?
Originally, a full version of Adobe's Acrobat application was required to create PDF (Portal Document Format) files from any application, including Microsoft Word. Subsequently, a number of companies sold inexpensive PDF conversion software to compete with the more expensive Adobe product. These applications, like Acrobat, used a printer driver to "print" Postscript-based PDF files. The Mac OS central window server caches window graphics in PDF, allowing any Macintosh application to print to a PDF file from within the OS.
Today, all current versions of Microsoft Word will save directly into PDF format. There's no need to use Visual Basic, assuming you have Microsoft Word.
You can create PDF files programmatically in VB6. You'll need the mjwPDF class and the appropriate PDF fonts. A tutorial on the subject has been attached to this page as a related link: Tutorial - Create PDF files with VB6
Inaddition, you also can use enolsoft PDF Creator to do that. It's fast and simple yet.
What is expansion of DOT in dot net language?
.NET- NETWORK ENABLED TECHNOLOGY
here . stands for LINKAGE BETWEEN MANY OBJECTS
Is c sharp a case sensitive language?
Yes.
The upper/lower case chars are regarded as being different in C.
For example, you can have two variables, one called 'x' and the other called 'X' and the compiler will recognize them as separate variables.
Write a program to print first 'n' Fibonacci 100 numbers?
#include<stdio.h> #include<conio.h> void fibo(int); void main() { int num; clrscr(); printf("\n\t Enter number of elements in series : "); scanf("%d",&num); if(num>0) fibo(num); else printf("\n\t Please enter positive number "); } void fibo(int num) { int a=0,b=1,c=0; if(num==1) printf("\n%d",a); if(num>=2) printf("\n%d\t%d\t",a,b); for(;num>2;num--) { c=a+b; a=b; b=c; printf("%3d\t",c); } getch(); }
What is the difference between Late binding and early binding?
Early binding. The type of the instance is determined in the compile time. It follows that the static (declared) type of the pointer or reference is used. This is the default for all methods in C++, C, or Object Pascal.
Late binding. The type of the instance is determined in the run time. It follows that the actual type of the instance is used and the method of this type is called. This is always used for the methods in Java. In C++, the virtual keyword denotes the methods using the late binding.
Late binding gives the class polymorphic behavior. On the other hand, late binding is less effective than early binding, even though the difference may be negligible. (In C++ on PCs, the difference between the late and the early binding is usually one machine instruction per method call.)
Any method that might be overridden in any of the derived classes should use the late binding.
Note:
In C++ and other OOP languages in which the late binding must be declared, the classes containing at least one virtual method are called polymorphic classes. Classes without any virtual method are called non-polymorphic classes. In languages like Java, where all the methods use late binding by default, all the classes are polymorphic.
What is the best way to learn C sharp?
I am a C sharp student right now learning to code.
I first tried to learn with books like C# for Beginners and stuff like that, but it didn't really work out. In my opinion, the best way to learn C sharp is if you learn it from any teacher. It could be you uncle, father, brother, or a certified teacher. That is better than learning it by yourself from a book. To become an expert you should try to find free projects to do on the internet which will really boost you in programming and you will be ahead of the rest.
What are the differences between class and abstract class?
Below is the main difference between the 3 components:
Write a program that accepts a number and output its equivalent in words?
/*mycfiles.wordpress.com
program to convert digits to character*/
#include
#include
void main()
{
int a[5],i,n;
clrscr();
cout<<"Enter the Value";
cin>>n;
for(i=4;i>=0;i--)
{
a[i]=n%10;
n=n/10;
}
for(i=0;i<5;i++)
{
if(a[i]!=0)
{
switch(a[i])
{
case 0:cout<<"Zero";
break;
case 1:cout<<"One";
break;
case 2:cout<<"Two";
break;
case 3:cout<<"Three";
break;
case 4:cout<<"Four";
break;
case 5:cout<<"Five";
break;
case 6:cout<<"Six";
break;
case 7:cout<<"Seven";
break;
case 8:cout<<"Eight";
break;
case 9:cout<<"Nine";
break;
}
}
}
getch();
}
------------------------------------------------------------------------------------
Program to Convert Numbers into Words
#include
void pw(long,char[]);
char *one[]={" "," one"," two"," three"," four"," five"," six"," seven","
eight"," Nine"," ten"," eleven"," twelve"," thirteen"," fourteen","
fifteen"," sixteen"," seventeen"," eighteen"," nineteen"};
char *ten[]={" "," "," twenty"," thirty"," forty"," fifty"," sixty","
seventy"," eighty"," ninety"};
void main()
{
long n;
clrscr();
printf("
Enter any 9 digit no: ");
scanf("%9ld",&n);
if(n<=0)
printf("Enter numbers greater than 0");
else
{
pw((n/10000000),"crore");
pw(((n/100000)%100),"lakh");
pw(((n/1000)%100),"thousand");
pw(((n/100)%10),"hundred");
pw((n%100)," ");
}
getch();
}
void pw(long n,char ch[])
{
(n>19)?printf("%s %s ",ten[n/10],one[n%10]):printf("%s ",one[n]);
if(n)printf("%s ",ch);
}
// for any query visit
// "http://www.c.happycodings.com/Beginners_Lab_Assignments/code51.html"
Program to Convert Numbers into Words
#include
void pw(long,char[]);
char *one[]={" "," one"," two"," three"," four"," five"," six"," seven","
eight"," Nine"," ten"," eleven"," twelve"," thirteen"," fourteen","
fifteen"," sixteen"," seventeen"," eighteen"," nineteen"};
char *ten[]={" "," "," twenty"," thirty"," forty"," fifty"," sixty","
seventy"," eighty"," ninety"};
void main()
{
long n;
clrscr();
printf("
Enter any 9 digit no: ");
scanf("%9ld",&n);
if(n<=0)
printf("Enter numbers greater than 0");
else
{
pw((n/10000000),"crore");
pw(((n/100000)%100),"lakh");
pw(((n/1000)%100),"thousand");
pw(((n/100)%10),"hundred");
pw((n%100)," ");
}
getch();
}
void pw(long n,char ch[])
{
(n>19)?printf("%s %s ",ten[n/10],one[n%10]):printf("%s ",one[n]);
if(n)printf("%s ",ch);
}
// for any query visit
// "http://www.c.happycodings.com/Beginners_Lab_Assignments/code51.html"
What do you mean by managed and unmanaged code in net?
"Unmanaged code" is a new name for an old concept. Unmanaged code stands for native machine code. Software is typically written in some high-level language such as Pascal, C or C++. These languages are translated into machine code (aka unmanaged code) by the compiler and its companion tools (assembler, linker, librarian, etc). The generated code runs natively on the host processor; that is, the processor directly executes the code generated by the compiler. This approach typically results in fastest code execution, but diagnosing and recovery from errors might be easier in managed code. Managed code is a new name, but the concept also is pretty old. Today, "managed code" typically stands for the system used by Microsoft .NET, but .NET is just one example of a managed code system. The .NET system takes source code in any of the supported languages (which include C, C++, C#, Pascal, and many others), and translates it into code designed for a virtual machine. The real processor cannot execute this code natively, but it can execute a program which then in turn executes the virtual machine's codes. The program that executes the virtual machine code is known as the virtual machine. While potentially slower than native code execution, the virtual machine can manage code (!) better than real machines. For example, the virtual machine can supervise memory allocation, automatically handle disposal of unused memory, and provide many other services that a native (unmanaged) application typically must explicitly provide. If the virtual machine does its job correctly, all applications using this virtual machine are likely to benefit. Virtual machines are also known under other names. In the Java system, the tool is called a JVM, a Java Virtual Machine. In the Microsoft .NET system, the intermediate language is called MSIL (Microsoft intermediate language), which are executed through a Just-in Time MSIL compiler (JIT-compiler). Early implementations of Pascal generated an intermediate code called P-code, executed at runtime through some P-code interpreter. Other forms of managed code exist.
Quite simply, an inner class is one class within another. Typically the inner class will be a private inner class, and will only be used by the outer class.
class MyOuterClass {
class MyInnerClass {
}
}
Why should main be declared static and is declaring it public and void not sufficient?
The static modifier means that it does not have to be instantiated to use it. Before a program runs there are technically no objects created yet, so the main method, which is the entry point for the application must be labeled static to tell the JVM that the method can be used without having first to create an instance of that class. Otherwise, it is the "Which came first, the chicken or the egg?" phenomenon. Your main method should be declared as follows: public static void main (String[] args) { lots of your java code... } As we know, java is a pure OOP , that means everything should be in the class, main. Aso, because main is itself a function, static member functions should not refer to objects of that class. But we can access static functions through classname itself, as: class TestMain { public static void main(String args[]) { body; } } Now, cmd>javac TestMain.java cmd>java TestMain as we know the static member functions has to call through its class name. That's why the programme name must be same as the class name ,where we wrote the main function. Another important point is : static variables or member functions will load during class. That means before creating any instances(objects), the main function is the first runnable function of any program which we run manually, such as : cmd>java TestMain(run) if , any sharing information.
What is difference between abstract class and interface in core java give brief answer with example?
Differences:
An interface can be considered as a pure abstract class that contains no method implementations and contains only declarations.
What is the use of console application in c sharp?
A console application is an Windows application where you only have access to a command-line console. You cannot use Win Forms with a console application.
The Console class contains methods that you can use to interact with the user, such as Console.WriteLine("Hello World!");
They are useful if you want to write a program that you can run from a command line that does not need a graphical interface.
What is the source code for Strassen's matrix multiplication program?
#include
#include
#include
#include "2DArray.h"
#define GRAIN 1024 /* product size below which matmultleaf is used */
void seqMatMult(int m, int n, int p, double** A, double** B, double** C)
{
for (int i = 0; i < m; i++)
for (int j = 0; j < n; j++)
{
C[i][j] = 0.0;
for (int k = 0; k < p; k++)
C[i][j] += A[i][k]*B[k][j];
}
}
void matmultleaf(int mf, int ml, int nf, int nl, int pf, int pl, double **A, double **B, double **C)
/*
subroutine that uses the simple triple loop to multiply
a submatrix from A with a submatrix from B and store the
result in a submatrix of C.
*/
// mf, ml; /* first and last+1 i index */
// nf, nl; /* first and last+1 j index */
// pf, pl; /* first and last+1 k index */
{
for (int i = mf; i < ml; i++)
for (int j = nf; j < nl; j++)
for (int k = pf; k < pl; k++)
C[i][j] += A[i][k]*B[k][j];
}
void copyQtrMatrix(double **X, int m, double **Y, int mf, int nf)
{
for (int i = 0; i < m; i++)
X[i] = &Y[mf+i][nf];
}
void AddMatBlocks(double **T, int m, int n, double **X, double **Y)
{
for (int i = 0; i < m; i++)
for (int j = 0; j < n; j++)
T[i][j] = X[i][j] + Y[i][j];
}
void SubMatBlocks(double **T, int m, int n, double **X, double **Y)
{
for (int i = 0; i < m; i++)
for (int j = 0; j < n; j++)
T[i][j] = X[i][j] - Y[i][j];
}
void strassenMMult(int mf, int ml, int nf, int nl, int pf, int pl, double **A, double **B, double **C)
{
if ((ml-mf)*(nl-nf)*(pl-pf) < GRAIN)
matmultleaf(mf, ml, nf, nl, pf, pl, A, B, C);
else {
int m2 = (ml-mf)/2;
int n2 = (nl-nf)/2;
int p2 = (pl-pf)/2;
double **M1 = Allocate2DArray< double >(m2, n2);
double **M2 = Allocate2DArray< double >(m2, n2);
double **M3 = Allocate2DArray< double >(m2, n2);
double **M4 = Allocate2DArray< double >(m2, n2);
double **M5 = Allocate2DArray< double >(m2, n2);
double **M6 = Allocate2DArray< double >(m2, n2);
double **M7 = Allocate2DArray< double >(m2, n2);
double **A11 = new double*[m2];
double **A12 = new double*[m2];
double **A21 = new double*[m2];
double **A22 = new double*[m2];
double **B11 = new double*[p2];
double **B12 = new double*[p2];
double **B21 = new double*[p2];
double **B22 = new double*[p2];
double **C11 = new double*[m2];
double **C12 = new double*[m2];
double **C21 = new double*[m2];
double **C22 = new double*[m2];
double **tAM1 = Allocate2DArray< double >(m2, p2);
double **tBM1 = Allocate2DArray< double >(p2, n2);
double **tAM2 = Allocate2DArray< double >(m2, p2);
double **tBM3 = Allocate2DArray< double >(p2, n2);
double **tBM4 = Allocate2DArray< double >(p2, n2);
double **tAM5 = Allocate2DArray< double >(m2, p2);
double **tAM6 = Allocate2DArray< double >(m2, p2);
double **tBM6 = Allocate2DArray< double >(p2, n2);
double **tAM7 = Allocate2DArray< double >(m2, p2);
double **tBM7 = Allocate2DArray< double >(p2, n2);
copyQtrMatrix(A11, m2, A, mf, pf);
copyQtrMatrix(A12, m2, A, mf, p2);
copyQtrMatrix(A21, m2, A, m2, pf);
copyQtrMatrix(A22, m2, A, m2, p2);
copyQtrMatrix(B11, p2, B, pf, nf);
copyQtrMatrix(B12, p2, B, pf, n2);
copyQtrMatrix(B21, p2, B, p2, nf);
copyQtrMatrix(B22, p2, B, p2, n2);
copyQtrMatrix(C11, m2, C, mf, nf);
copyQtrMatrix(C12, m2, C, mf, n2);
copyQtrMatrix(C21, m2, C, m2, nf);
copyQtrMatrix(C22, m2, C, m2, n2);
// M1 = (A11 + A22)*(B11 + B22)
AddMatBlocks(tAM1, m2, p2, A11, A22);
AddMatBlocks(tBM1, p2, n2, B11, B22);
strassenMMult(0, m2, 0, n2, 0, p2, tAM1, tBM1, M1);
//M2 = (A21 + A22)*B11
AddMatBlocks(tAM2, m2, p2, A21, A22);
strassenMMult(0, m2, 0, n2, 0, p2, tAM2, B11, M2);
//M3 = A11*(B12 - B22)
SubMatBlocks(tBM3, p2, n2, B12, B22);
strassenMMult(0, m2, 0, n2, 0, p2, A11, tBM3, M3);
//M4 = A22*(B21 - B11)
SubMatBlocks(tBM4, p2, n2, B21, B11);
strassenMMult(0, m2, 0, n2, 0, p2, A22, tBM4, M4);
//M5 = (A11 + A12)*B22
AddMatBlocks(tAM5, m2, p2, A11, A12);
strassenMMult(0, m2, 0, n2, 0, p2, tAM5, B22, M5);
//M6 = (A21 - A11)*(B11 + B12)
SubMatBlocks(tAM6, m2, p2, A21, A11);
AddMatBlocks(tBM6, p2, n2, B11, B12);
strassenMMult(0, m2, 0, n2, 0, p2, tAM6, tBM6, M6);
//M7 = (A12 - A22)*(B21 + B22)
SubMatBlocks(tAM7, m2, p2, A12, A22);
AddMatBlocks(tBM7, p2, n2, B21, B22);
strassenMMult(0, m2, 0, n2, 0, p2, tAM7, tBM7, M7);
for (int i = 0; i < m2; i++)
for (int j = 0; j < n2; j++) {
C11[i][j] = M1[i][j] + M4[i][j] - M5[i][j] + M7[i][j];
C12[i][j] = M3[i][j] + M5[i][j];
C21[i][j] = M2[i][j] + M4[i][j];
C22[i][j] = M1[i][j] - M2[i][j] + M3[i][j] + M6[i][j];
}
Free2DArray< double >(M1);
Free2DArray< double >(M2);
Free2DArray< double >(M3);
Free2DArray< double >(M4);
Free2DArray< double >(M5);
Free2DArray< double >(M6);
Free2DArray< double >(M7);
delete[] A11; delete[] A12; delete[] A21; delete[] A22;
delete[] B11; delete[] B12; delete[] B21; delete[] B22;
delete[] C11; delete[] C12; delete[] C21; delete[] C22;
Free2DArray< double >(tAM1);
Free2DArray< double >(tBM1);
Free2DArray< double >(tAM2);
Free2DArray< double >(tBM3);
Free2DArray< double >(tBM4);
Free2DArray< double >(tAM5);
Free2DArray< double >(tAM6);
Free2DArray< double >(tBM6);
Free2DArray< double >(tAM7);
Free2DArray< double >(tBM7);
}
}
void matmultS(int m, int n, int p, double **A, double **B, double **C)
{
int i,j;
for (i=0; i < m; i++)
for (j=0; j < n; j++)
C[i][j] = 0;
strassenMMult(0, m, 0, n, 0, p, A, B, C);
}
int CheckResults(int m, int n, double **C, double **C1)
{
#define THRESHOLD 0.001
//
// May need to take into consideration the floating point roundoff error
// due to parallel execution
//
for (int i = 0; i < m; i++) {
for (int j = 0; j < n; j++) {
if (abs(C[i][j] - C1[i][j]) > THRESHOLD ) {
printf("%f %f\n", C[i][j], C1[i][j]);
return 1;
}
}
}
return 0;
}
int main(int argc, char* argv[])
{
clock_t before, after;
int M = atoi(argv[1]);
int N = atoi(argv[2]);
int P = atoi(argv[3]);
double **A = Allocate2DArray< double >(M, P);
double **B = Allocate2DArray< double >(P, N);
double **C = Allocate2DArray< double >(M, N);
double **C4 = Allocate2DArray< double >(M, N);
int i, j;
for (i = 0; i < M; i++) {
for (j = 0; j < P; j++) {
A[i][j] = 5.0 - ((double)(rand()%100) / 10.0);
}
}
for (i = 0; i < P; i++) {
for (j = 0; j < N; j++) {
B[i][j] = 5.0 - ((double)(rand()%100) / 10.0);
}
}
printf("Execute Standard matmult\n\n");
before = clock();
seqMatMult(M, N, P, A, B, C);
after = clock();
printf("Standard matrix function done in %7.2f secs\n\n\n",(float)(after - before)/ CLOCKS_PER_SEC);
before = clock();
matmultS(M, N, P, A, B, C4);
after = clock();
printf("Strassen matrix function done in %7.2f secs\n\n\n",(float)(after - before)/ CLOCKS_PER_SEC);
if (CheckResults(M, N, C, C4))
printf("Error in matmultS\n\n");
else
printf("OKAY\n\n");
Free2DArray(A);
Free2DArray(B);
Free2DArray(C);
Free2DArray(C4);
return 0;
}
Explain the differences between Assembly Language and High Level Language?
Assembly language is used to write programs using the instruction set for a particular processor/controller.(example : 8051 or 8086 or MIPS).
Assembly Language require an ASSEMBLER to convert the assembly code to machine level code(HEX CODE)
High Level Language require a Compiler to convert into ASSEMBLY THEN machine level code.(Now-a-days compilers are smart enough to generate the machine code directly)
To write assembly code it is necessary to know the architecture of the processor or controller.
To write an High Level Program it is not neccessay to know the architecture completly.
Assembly language is not protable.
High Level Language is Portable.
with regards
Mohan Kumar.J
MCIS,
MANIPAL.
Assembly language is used to write programs using the instruction set for a particular processor/controller.(example : 8051 or 8086 or MIPS).
High Level Language is used to write programs using some grammer rules or languages created like C,PASCAL,FORTRN,JAVA.
Assembly Language require an ASSEMBLER to convert the assembly code to machine level code(HEX CODE)
High Level Language require a Compiler to convert into ASSEMBLY THEN machine level code.(Now-a-days compilers are smart enough to generate the machine code directly)
To write assembly code it is necessary to know the architecture of the processor or controller.
To write an High Level Program it is not neccessay to know the architecture completly.
Assembly language is not protable.
High Level Language is Portable.
with regards
Mohan Kumar.,
MCIS,
MANIPAL.
EACH HLL INSTRUCTION SPECIFY SEVERAL INSTRUCTIONS IN isa OF COMPUTER. WHEREAS EACH aSSEMBLY LEVEL INSTRUCTION SPECIFIES A SINGLE INSTRUCTION IN ISA OR MACHINE LEVEL LANGUAGE
PRIYA BAJAJ
WIPRO TECHNOLOGIES
BANGALORE
Answer--Assembly language :-A programming language that is once removed from a computer's machine language. Machine languages consist entirely of numbers and are almost impossible for humans to read and write. Assembly languages have the same structure and set of commands as machine languages, but they enable a programmer to use names instead of numbers.
Each type of CPU has its own machine language and assembly language, so an assembly language program written for one type of CPU won't run on another. In the early days of programming, all programs were written in assembly language. Now, most programs are written in a high-level language such as FORTRAN or C. Programmers still use assembly language when speed is essential or when they need to perform an operation that isn't possible in a high-level language.
High-level language:-
-JP Morgan
A programming language such as C, FORTRAN, or Pascal that enables a programmer to write programs that are more or less independent of a particular type of computer. Such languages are considered high-level because they are closer to human languages and further from machine languages. In contrast, assembly languages are considered low-level because they are very close to machine languages.
The main advantage of high-level languages over low-level languages is that they are easier to read, write, and maintain. Ultimately, programs written in a high-level language must be translated into machine language by a compiler or interpreter.
The first high-level programming languages were designed in the 1950s. Now there are dozens of different languages, including Ada, Algol, BASIC, COBOL, C, C++, FORTRAN, LISP, Pascal, and Prolog.
An assembly language is where each statement corresponds to one machine instruction. A high level language is where each statement corresponds to more than one, sometimes many, machine instructions.
Pointer is a variable holding a memory address?
pointer is a derived datatype which contains memory addresses as their values.
program:-
#include<stdio.h>
#include<conio.h>
void main()
{
int m=5,*p;
clrscr();
p=&m;
printf("address of variable m is %p",(void *)p);
}
C doesn't have interfaces like Java does. In fact, it doesn't even have classes. The closes thing it has to interfaces might be a pointer to a function, which could point to one of several different functions without the caller having to know which one exactly. C does not have interfaces or classes. However it's quite easy to simulate interfaces and classes in C. Before I get into doing that, let me explain what interfaces are and how it's done in C++, which supports multiple inheritance which is much more powerful then interface inheritance.
Interface inheritance is basically the same thing as multiple inheritance. In interface inheritance, the interfaces are classes that cannot have method implementations and variables. They may only have function prototypes. You are only allowed to inherit from one full blown class as a child in the interface inheritance model.
However, in multiple inheritance (which C++ supports), you're allowed to inherit from as many full classes as you want. This allows you to make those full blown classes as slim as a bunch of pure virtual functions (interface) or as full classes with method implementations and variables. For example, to implement something similar to a comparable interface in C++:
class Comparable
{
public:
virtual int compareTo(void* x) = 0;
};
class Foobar: public Comparable
{
public:
virtual int compareTo(void* x) { /*compare implementation here */ }
//rest of class
};
That would be pretty much the same thing as interface inheritance in Java. Any function that takes a Comparable pointer or reference will also be able to take Foobar. In C, you'd have to use function pointers to achieve the same effect. Basically in your structure, you'd have to have a pseudo v-table... a bunch of function pointers:
struct Comparable
{
int (*compareTo)(void* x) = 0;
};
struct Foobar
{
int (*compareTo)(void* x);
//rest of structure
int i;
int j;
int k;
};
void InitFoobar(struct Foobar* this)
{
this->compareTo = /*compare to function*/;
//rest of the initialization
this->i = 0;
this->j = 1;
this->k = 2;
}
If you want to pass Foobar into a function that takes a Comparable pointer, just cast the Foobar pointer to a Comparable pointer. The C standard guarantees structures Comparable and Foobar will be laid out exactly the same as long as the variables are declared in the same order. So the first 4 bytes, the function pointer, will be at the exact same offsets in both Comparable and Foobar. However, after the first 4 bytes, Foobar will have extra 12 bytes of stuff where Comparable will not. This memory arrangement lets you treat Foobar exactly like a Comparable. This is also how single inheritance is normally implemented in most languages.
How do you add programme comments?
It depends on the language.
In most cases a remark or comment is denoted by a token or symbol such that the remainder of that line is ignored by the language compiler or interpreter. That is, the comment extends to the end of the line it appears on (known as a single-line comment). However, some languages require that comments be placed on a separate line, by themselves, including BASIC which traditionally opens a comment with the keyword REM (short for remark).
In C, comments are enclosed in paired delimiters, beginning with /* and ending with */. This convention allows comments to extend across multiple lines as well as to insert comments inside code statements. Languages derived from C, including C++ and C#, also use this convention (known as a C-style comment), but they also allow single-line comments beginning with a // (double-slash) token. Java uses the same syntax as C++ and therefore uses the same comment style. Some languages use the # (pound) symbol to begin a comment while Visual Basic uses a ' (apostrophe).
Additional information on comments can be found in your language documentation.
What is static void main in c sharp?
The main function of a C or C++ program is int main (int argc, char *argv[]);
This is the programmer's supplied entry point. It is called by the run-time library after it has completed its own initialization. It is called main, and there must be one and only one main function at global scope in the link with this signature.
It takes two arguments, one of type int, the other of type pointer to array of pointers to strings. Traditionally, they are called argc and argv, but you can call them anything you want.
Argc holds the number of arguments on the command line. The command line includes the program's name, so argc will never be less than 1. If you had one actual argument, then argc would be 2, etc.
Argv is an array of pointers to strings. Argv[0] points to the program name. If argc is greater than 1, then argv[1] points to the first actual argument; if argc is greater than 2, then argv[2] points to the second actual argument, etc. Depending on the implementation, argv[0] might be just the program name, it might be its fully qualified path name, or it might be what was typed on the command line.
These arguments are parsed from the command line by simple white space, although some operating systems and libraries "might" handle quoted strings for you. Each argument is terminated by a null ('\0') character. It is important that you do NOT attempt to change any of these arguments. Treat them as read only. For example, if you are going to call certain library functions such as strtok on them, you need to make a copy first and call strtok on the copy. It is also important that you not attempt to reference a particular argv value without first checking that the argc value indicates its presence, otherwise you might cause a bus exception.
When your program is done, it is expected to return from main with an int value. The defined value for successful execution is zero. Small positive numbers, typically up to 255, depending on the operating system and library, can be used to indicate different conditions and errors.
Some implementations provide a third argument, char *envp[], which is an array of pointers to environment variable strings, terminated by one null pointer. This construct, however, is not ANSI standard. It is a common extension in Microsoft and Unix platforms, but other means should be used to access the environment, as it is not portable.
Why do abstract class can not be inherited?
An abstract class is designed to provide function and organization to subclasses without ever existing as an object itself. In other words, it is a glorified template, an abstraction for subclasses, and would be illogical to instantiate.
As an example, imagine that a zoo wanted to make separate classes representing each of its animals, but wanted them to all have some common features like a variable for life expectancy or a method to project feeding costs. To force every class to implement this functionality, the programmer may create an abstract class called Animal that each subclass would extend. However, would it ever make sense to create an Animal? No, because an Animal does not exist anywhere in the zoo - an Alligator however might.