Q:

difference between structure and a class

   
// Program 1 
#include <stdio.h> 
  
class Test { 
    int x; // x is private 
}; 
int main() 
{ 
  Test t; 
  t.x = 20; // compiler error because x is private 
  getchar(); 
  return 0; 
} 
1

New to Communities?

Join the community